Tommy_Oh_Boy
New Member
- Joined
- Sep 12, 2023
- Messages
- 9
- Office Version
- 365
hi Excel Gru,
I'm hoping to get some help.
I have this code, but keep getting stuck on the first find. Do you know why clicking a button with the below macro assigned, won't move the selection to the next find?
I'm hoping to get some help.
I have this code, but keep getting stuck on the first find. Do you know why clicking a button with the below macro assigned, won't move the selection to the next find?
VBA Code:
Dim LastCell As Range
Sub FindIT()
Dim f As Range
Dim rngSearch As Range
Dim LastCell As Range
With ActiveSheet
Set rngSearch = .Range("F10:F2000")
If LastCell Is Nothing Then Set LastCell = rngSearch.Cells(rngSearch.Rows.Count, rngSearch.Columns.Count)
With rngSearch
Set f = .Find(what:="*", after:=LastCell, lookat:=xlPart)
If Not f Is Nothing Then
Set LastCell = f
f.Activate
If Intersect(ActiveWindow.VisibleRange, f) Is Nothing Then
ActiveWindow.ScrollRow = f.Row
End If
End If
End With
End With
End Sub