Hi to all,
this macro color alternate rows if column A is not empty.
Is it possible to modify "or even the B / C column" ?
thank you
xam
this macro color alternate rows if column A is not empty.
Is it possible to modify "or even the B / C column" ?
Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim bClr As Boolean
Dim c As Range, rChanged As Range
Dim cols As Long
Const sRange As String = "A2:H500"
Set rChanged = Intersect(Target, Range(sRange).Columns(1))
If Not rChanged Is Nothing Then
Application.ScreenUpdating = False
With Range(sRange)
.Interior.ColorIndex = xlNone
cols = .Columns.Count
End With
For Each c In Range(sRange).Columns(1).Cells
If c.Value <> vbNullString Then
If bClr Then
c.Resize(, cols).Interior.ColorIndex = 15
End If
bClr = Not bClr
End If
Next c
Application.ScreenUpdating = True
End If
End Sub
xam