Monday, 15 December 2014

Microsfot Excel - Macro - For loop and If statement example

Watch this example on YouTube


Sub test()
    Range("A1:C4").Select
    Dim selectedCell As Range
    For Each selectedCell In Selection
        If selectedCell.Value = "frank" Then
            selectedCell.Interior.Color = vbRed
        End If
    Next
End Sub

No comments:

Post a Comment