Find and GoTo with Loop and Input Box

mt

Board Regular
Joined
Feb 24, 2006
Messages
134
I know this code is messed up and was hoping for some help. I am trying to write a code that would allow the user to input a Parcel,Lot# and want to search 10 Worksheets named Data 1 thru 10 in one workbook. The matching records should be found in range AF of each sheet, if the record exists. If the matching record is found, I want the user to be able to input data into the worksheet, then have the option to search for another lot and repeat. If the record does not exist, then the user should have the option to search for another record.

Please do not get sick over my lame attempt. Thanks for the help.
Mike

Code:
Sub findtest()
Dim wks As Worksheet
Dim rng As Range
Dim StrAddress As String, StrFind As String

Do
StrFind = InputBox("Please enter search parcel,lot") & "Stakeout property corners, bldg corners, elevation"
'Range AF of each data sheet will contain a match for the StrFind
For i = 1 To 10

With Worksheets("Data" & i) '.Range("AF5:AF" & LRow)
LRow = Worksheets("Data" & i).Range("A65536").End(xlUp).Row
    For Each Ce In Worksheets("Data" & i).Range("AF5:AF" & LRow)
    Set rng = Worksheets("Data" & i).Range("AF5:AF" & LRow).Find(StrFind, lookat:=xlWhole, LookIn:=xlValues)
        If Not rng Is Nothing Then
            Application.Goto Reference:=rng, Scroll:=True
                rng.Offset(0, 20).Select
                     
              If MsgBox("Seach for another Lot?", vbYesNo + vbQuestion) = vbNo Then Exit Sub
                
            ElseIf MsgBox("Could not find Lot, Search for another Lot?", vbYesNo + vbQuestion) = vbNo Then Exit Sub    'if not match found
        
        
        End If
        Next Ce
End With
Next i
Loop
End Sub
 
Most welcome. Good luck with them.
They're very versatile & flexible to work with, which means there will be a lot to take into
account but they're what I enjoy building/working with the most.

When you show your UForm, you'll want to show it modeless in order to have the sheet
interaction while it's showing.

(ie.) Instead of showing it with:
UserForm1.Show
you'll want to use:
UserForm1.Show vbModeless
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,215,223
Messages
6,123,727
Members
449,116
Latest member
Aaagu

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