reddcannon
Board Regular
- Joined
- Aug 11, 2011
- Messages
- 118
I have this button with the code below it works 1 or 2 times, then I get the Run-time error 91, object variable or with block variable not set.
It will not work at all if I protect my worksheet with a password, which I must do. This spreadsheet is just for people to enter a part number and look up prices. That is it. I just need them to click the button and type the part number and it finds it.
Private Sub CommandButton2_Click()
'Opens box and ask what do they want to search
searchthis = InputBox("Type in a location keyword.", "Property Search")
'Tells where to search
Columns("a").Select
'and then search in them whatever the user entered:
Selection.Find(What:=searchthis, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext).Activate
End Sub
It will not work at all if I protect my worksheet with a password, which I must do. This spreadsheet is just for people to enter a part number and look up prices. That is it. I just need them to click the button and type the part number and it finds it.
Private Sub CommandButton2_Click()
'Opens box and ask what do they want to search
searchthis = InputBox("Type in a location keyword.", "Property Search")
'Tells where to search
Columns("a").Select
'and then search in them whatever the user entered:
Selection.Find(What:=searchthis, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext).Activate
End Sub