Work sheet event Worksheet_activate is used.
Code
Private Sub Worksheet_Activate()
Dim cel As Range
Dim k1 As Long, k2 As Long, k3 As Long
For Each cel In Range("B4:B500")
If Left(cel, 4) = "Week" Then
k = Replace(cel, "Week ", "") + 0
k1 = k Mod 8
k2 = k Mod 5
k3 = k Mod 3
cel.Interior.Color = RGB((k1 * 30), k2 * 40, 255 - (k3 * 30))
End If
Next cel
End Sub
To paste the code.
Right click on Sheet tab
view code
VB window opens
Paste the code.
Close window.
When the sheet is activated cells will be colored.
Bookmarks