VBA Excel - Procurando um valor na Coluna A com Looping - Find a Value in Column A using a loop

Sub FindValue()

'This example Loops through Column"A", and searches for
'a value selected from the input box and diplays the address with a MsgBox

    Dim r As Range
    Dim c As Range
    Dim s As String
    Dim ms As String

    Set r = Range("A1", Range("A65536").End(xlUp))

    Let ms = "The Value was found at  "
    Let s = InputBox("Enter Value to Find", "Hello", "Enter Number Here")

    For Each c In r.Cells
        If c = s Then MsgBox ms & c.Address
    Next c

End Sub

Tags: Excel, VBA, Find, Value, Column, loop, Range.  



Inline image 1

Nenhum comentário:

Postar um comentário

diHITT - Notícias