VBA Find

mt

Board Regular
Joined
Feb 24, 2006
Messages
134
Am I using the wrong worksheet funtion here? The code does not seem to recognize the string that I am searching for. The string is composed of an alpha numeric combination plus text. It seems to work when I simplify the search string to a number. I appreciate the help.
Mike
Code:
Sub find_me()
Dim i As Long
Dim inp, sht, n As String
Dim c As Object
On Error Resume Next
start:
inp = InputBox("Please enter search parcel,lot") & "Stakeout property corners, bldg corners, elevation"
For i = 1 To 10
sht = "Data" & i
    With Sheets(sht).Columns("AF")
        Set c = .Find(inp, , , xlWhole)
            If Not c Is Nothing Then
                Sheets(sht).Select
                    c.Offset(, -20).Select
                        n = 1
                        If MsgBox("Seach for another Lot?", vbYesNo + vbQuestion) = vbYes Then
                            GoTo start:
                            Else
                                Exit Sub
                        End If
            End If
    End With
Next
If n <> 1 Then
    If MsgBox("Could not find Lot, Search for another Lot?", vbYesNo + vbQuestion) = vbNo Then
        Exit Sub    'if not match found
            Else
                GoTo start:
    End If
End If
End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top