Coloring cells using VBA in excel
Bob
iColor = 99 throws an error in 2003
Change to anything <57 and OK
Gord
On Sun, 25 Apr 2010 17:39:40 +0100, "Bob Phillips"
wrote:
TRy
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Long
Dim cell As Range
If Not Intersect(Target, Range("B4:J33")) Is Nothing Then
For Each cell In Target
Select Case cell
Case "Dan"
icolor = 34
Case "John"
icolor = 35
Case "Rose"
icolor = 38
Case Else
icolor = 99
End Select
cell.Interior.ColorIndex = icolor
Next cell
End If
End Sub
|