Forum Discussion

Kay Fraone's avatar
Kay Fraone
Copper Contributor
Aug 07, 2017
Solved

Alternating row colors

Hello all, I often use =Mod(row),2)-1 to apply alternating row colors, where the first row does not receive the formatting.  I also have a simple macro that I use to run that type of conditional for...
  • Matt Mickle's avatar
    Aug 09, 2017

    Something like this will work:

     

    Sub Test()
    
        Dim myVar As Long
    
        myVar = ActiveCell.Row
        
        If myVar Mod 2 = 1 Then
            MsgBox "I'm an odd number!"
        Else
            MsgBox "I'm an even number"
        End If
    
    End Sub

Resources