Thomas Risi Softwareentwicklung
Addins - Datenbanklösungen - Komponenten - RTDServer - WebServices
Zeilen abwechselnd färben
Aus einer Frage in einem Forum ...
Eine Funktion, die die Zeilen eines Bereiches abwechselnd färbt.
Option Explicit
Const DEFAULT_COLOR = 5
Sub Test()
clrRows ActiveSheet.Range("A1:J10")
End Sub
Public Sub clrRows(rng As Excel.Range, _
Optional clrIndex1 = DEFAULT_COLOR, _
Optional clrIndex2 = xlColorIndexNone)
Dim i As Long
Application.ScreenUpdating = False
With rng
For i = 1 To .Rows.Count
If .Rows(i).EntireRow.Row Mod 2 = 0 Then
.Rows(i).Interior.ColorIndex = clrIndex1
Else
.Rows(i).Interior.ColorIndex = clrIndex2
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
© 2001 -
by Thomas Risi