Sub Macro1()
Dim linha As Integer
linha = 2
While Range("A" & linha & ":" & "E" & linha).Select And ActiveCell <> ""
If (linha Mod 2 = 0) Then
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
End With
End If
linha = linha + 1
Wend
End Sub
adicionar também bordas
se for par e se for impar a diferença é que se for impar não muda a cor
Sub Macro1()
Dim linha As Integer
linha = 2
While Range("A" & linha & ":" & "E" & linha).Select And ActiveCell <> ""
If (linha Mod 2 = 0) Then
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.Weight = xlThin
End With
Else
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.Weight = xlThin
End With
End If
linha = linha + 1
Wend
End Sub
Nenhum comentário:
Postar um comentário