You don't check if there is a valid match, I suspect that is the case:
Private sub button_save_Click()
Dim ws As excel.Worksheet
Dim Employee As excel.range
Dim Name As String
Set ws = Worksheets("hotel")
With ws.Range("c1:c900")
Name = b.Value -> "// 'b' is the name of textbox
Set Employee = .Find(what:=Name, LookIn:=xlValues)
if not employee is nothing then
Employee.Rows.Offset(0, 0).Value = Name "//While clicking save button after editing data in textbox I'm getting Run
time error 91 here
else
msgbox "'"Name & "' not found in worksheet", vbokonly
endif
End With
Set Employee = Nothing
End Sub
I suspect the employee.rows.offset(0,0).value = b.value isn't right either, where are you trying to place the name relative to the found name, and what do you really want to put in the cell?
Bookmarks