reddcannon
Board Regular
- Joined
- Aug 11, 2011
- Messages
- 118
Good afternnon you wonderful folks. You all provided me with the code below and it is fantastic. BUT after using it I realized one problem. we had to change the Lookat:=xlpart to Whole so it would find the exact match to the part number, and that works great, however some part numbers are names and some names are very long, if I change back to xlpart I can search by part of the name but then back to the problem with the part number, example it will go to 275 if I search for 75. Is there an easy solution, see code below
Private Sub CommandButton2_Click()
Dim searchthis As String, Found As Range
Me.Unprotect Password:="123"
searchthis = InputBox("Type Number.", "Property Search")
Set Found = Range("A:A C:C").Find(What:=searchthis, LookIn:=xlFormulas, LookAt:=xlWhole)
If Not Found Is Nothing Then Found.Select
Me.Protect Password:="123"
End Sub
Private Sub CommandButton2_Click()
Dim searchthis As String, Found As Range
Me.Unprotect Password:="123"
searchthis = InputBox("Type Number.", "Property Search")
Set Found = Range("A:A C:C").Find(What:=searchthis, LookIn:=xlFormulas, LookAt:=xlWhole)
If Not Found Is Nothing Then Found.Select
Me.Protect Password:="123"
End Sub