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
 

Some videos you may like

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Watch MrExcel Video

Forum statistics

Threads
1,111,911
Messages
5,541,543
Members
410,549
Latest member
Anaarchie
Top