I have a database in my excel. On userform i pasted a command button with the name UPDATE. on the click event, the data to the corresponding File no. will populate in respective textfields. My intention is to, if any modify in one or two textfields, when I click on the update button the same will save with changed data. At present the code is:
Dim ws As Worksheet Dim uf As UserForm Dim wslastrw As Long, filerow As Long Dim fileno As String Dim filefnd As Range Set uf = formcalsheet fileno = uf.txtfileno.Text If fileno = "" Then MsgBox "Please enter a valid File No." Exit Sub End If Set ws = Worksheets("Employee Details") wslastrw = ws.Range("A" & Rows.Count).End(xlUp).Row With ws Set filefnd = .Range("A2:A" & wslastrw).Find(what:=fileno, after:=.Range("A2"), _ LookIn:=xlValues, lookat:=xlPart, searchorder:=xlByRows, searchdirection:=xlNext, _ MatchCase:=False) If filefnd Is Nothing Then MsgBox "No File with this File No. exists." & Chr(10) & "Please enter a valid File No." Exit Sub Else filerow = filefnd.Row End If Frame1.Visible = True uf.txtname.Value = ws.Range("B" & filerow).Value uf.txtdesign.Value = ws.Range("C" & filerow).Value uf.txtdob.Value = ws.Range("D" & filerow).Value uf.txtdoj.Value = ws.Range("E" & filerow).Value uf.txtdor.Value = ws.Range("F" & filerow).Value uf.txtpay.Value = ws.Range("J" & filerow).Value uf.txtda.Value = ws.Range("L" & filerow).Value Pls suggest me the solution. -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel