Wednesday, July 20, 2022

How to find value at which cell in Excel VBA IF else condition for loop


Public Sub LoopCells()

Dim c As Range

For Each c In Range("A1:A10")

    If c.Value = "FindMe" Then

      MsgBox "FindMe found at " & c.Address

    End If

Next c

End Sub

 


Public Sub LoopColumn()

Dim c As Range

For Each c In Range("A:A")

    If c.Value = "FindMe" Then

      MsgBox "FindMe found at " & c.Address

    End If

Next c

End Sub 

No comments:

Post a Comment