View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Marco Marco is offline
external usenet poster
 
Posts: 69
Default if statement to shade cells (more than 3 conditions)

Hi JE. I also have a problem like this. I need this:
http://www.microsoft.com/communities...b-9966cf95be93

How can I control that?

Regards,
Marco



"JE McGimpsey" wrote:

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