Good morning!
I was hoping for a push in the right directly. Another awesome user told me about .find and he set it up for me for a find button in my spreadsheet. My problem is I wish to only search 2 of the columns on my sheet.
I have been trying to locate info on my own, see here:
http://msdn.microsoft.com/en-us/libr...ice.15%29.aspx
But I cannot seem to find anything showing how to specify where to search. A push in the right direction would be appreciated.
Here is the code I am using
Sub CommandButton12_Click()
Dim str As String, sh1 As Worksheet, c, x As Long, y As Long
Set sh1 = Sheets("Inventory")
With sh1.Cells
str = "*" & InputBox("Find Value") & "*"
Set c = .Find(str, LookIn:=xlValues)
x = Application.CountIf(sh1.Cells, str)
y = x - 1
If Not c Is Nothing Then
firstaddress = c.Address
Do
Application.Goto c
Msgtext = MsgBox("Found: " & x & " Matches" & vbNewLine & vbNewLine & _
"Remaining: " & y & vbNewLine & vbNewLine & "Goto Next?", vbYesNo, "Itterate Through Found Values")
If Msgtext = vbNo Then
Exit Sub
Else
GoTo 1
End If
1
Set c = .FindNext(c)
y = y - 1
If y = 0 Then Application.Goto c: Exit Sub
Loop While Not c Is Nothing And c.Address <> firstaddress
End If
End With
End Sub
Thanks in advance!
Oh forgot, Want to search columns G and J -OR- Search entire sheet but ignore Columns A and B
Bookmarks