Hi everyone,
I would like to make the following code into a loop, but I do not understand how to do this - I'm hoping somebody can edit it to make it check for the numbers 1 to 100! Thanks in advance.
I would like to make the following code into a loop, but I do not understand how to do this - I'm hoping somebody can edit it to make it check for the numbers 1 to 100! Thanks in advance.
VBA Code:
Sub FindAll()
Dim fnd As String, FirstFound As String
Dim FoundCell As Range, Rng As Range
Dim myRange As Range, LastCell As Range
fnd = "UNSURE OF WHAT TO PUT HERE"
Set myRange = Sheets("Sheet1").Range("A1:A100")
Set LastCell = myRange.Cells(myRange.Cells.Count)
Set FoundCell = myRange.Find(what:=fnd, after:=LastCell)
If Not FoundCell Is Nothing Then
FirstFound = FoundCell.Address
Else
GoTo NothingFound
End If
Set Rng = FoundCell
Do Until FoundCell Is Nothing
Set FoundCell = myRange.FindNext(after:=FoundCell)
Set Rng = Union(Rng, FoundCell)
If FoundCell.Address = FirstFound Then Exit Do
Loop
Rng.EntireRow.Select
Exit Sub
NothingFound:
MsgBox "No values were found in this worksheet"
End Sub