Nest If statement in Do Loop While with comparison operators : Cell « Excel « VBA / Excel / Access / Word






Nest If statement in Do Loop While with comparison operators

 
Sub IfDo()
    Dim I As Integer
    I = 1
    Do
          If (Cells(I, "A").Value = "A") Then
                MsgBox ("I found a A in row " & Str(I))
          End If
          I = I + 1
    Loop While (Cells(I, "A").Value <> "")
End Sub

 








Related examples in the same category

1.Is a cell empty
2.Get the last cell
3.Magic Squares
4.Nest If statement in Do Loop Until for cells
5.Is active cell empty
6.Transposing is taking a rectangular block of data and rotating it so that columns become rows and vice versa.
7.Uses nested For/Next loops to count the total number of cells used in all open worksheets:
8.Selects cell G4
9.A better way to write to a range:Filling a range
10.Use arrays to fill ranges faster
11.Moving the pointer to the cell containing the greatest value