if statement to shade cells (more than 3 conditions)
One way:
Put this in your worksheet code module (right-click the worksheet tab
and choose View Code):
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Range("E4")
If Not Intersect(Target.Cells, .Cells) Then
Select Case .Value
Case 2
.Interior.ColorIndex = 5
Case 3
.Interior.ColorIndex = 6
Case 4
.Interior.ColorIndex = 4
Case 5
.Interior.ColorIndex = 53
Case 6
.Interior.ColorIndex = 13
Case Else
.Interior.ColorIndex = xlColorIndexNone
End Select
End If
End WIth
End Sub
In article ,
Mo2 wrote:
If A4= 2, shade E4 blue
If A4= 3, shade E4 yellow
If A4=4, shade E4 brown
If A4=5, shade E4 orange
If A4=6, shade E4 purple
can't use conditional formatting (there is more than 3 conditions)
can anyone help?
P.S. i know nothing about visual basic
|