Get Values from 1st Row of Cells in EXCEL

I need the code that will do the following in EXCEL:

1) Go through the first row and get the value from each cell one at a time.
2) If the value in a cell is equal to "expected" then identify what the column is (A, B, C, etc.) and output that value (for the sake of this example just output to a msgbox).

CVGunxAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
rettiseertConnect With a Mentor Commented:
This:

    Dim cel As Range
    Dim i As Long
    Dim expected As Double
   
    expected = 1.5
   
   
    For i = 1 To 255
        Set cel = ActiveSheet.Cells(1, i)
        If cel.Value = expected Then
            MsgBox cel.Address
        End If
    Next
0
All Courses

From novice to tech pro — start learning today.