5 conditions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After pasting the following code in the worksheet tab - view code - save and I did not get any result
does any one know why

Private Sub Worksheet_Change(ByVal Target As Excel.Range
If Not Intersect(Target, Range("A1")) Is Nothing The
With Range("A1"
If IsNumeric(.Value) The
Select Case .Valu
Case Is > 11
.Interior.ColorIndex = 5 'blu
Case Is >= 10
.Interior.ColorIndex = 10 'gree
Case Is >= 9
.Interior.ColorIndex = 46 'orang
Case Els
.Interior.ColorIndex = 2 'whit
End Selec
Els
.Interior.ColorIndex = xlColorIndexNon
End I
End Wit
End I
End Su
 
After pasting the following code in the worksheet tab - view code - save and I did not get any result
does any one know why ?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
With Range("A1")
If IsNumeric(.Value) Then
Select Case .Value
Case Is > 110
.Interior.ColorIndex = 5 'blue
Case Is >= 100
.Interior.ColorIndex = 10 'green
Case Is >= 95
.Interior.ColorIndex = 46 'orange
Case Else
.Interior.ColorIndex = 2 'white
End Select
Else
.Interior.ColorIndex = xlColorIndexNone
End If
End With
End If
End Sub

It works for me.

What do you mean when you say "I did not get any result".

If what you mean is that the color of the cell doesn't change, most likely you
do not have a numeric value in A1 that is in the range you've specified. Or
you are looking for a result that is not called for in the code you posted.




--ron
 
If I replace A1 with

A1:AZ39 as the range

such as

Private Sub Worksheet_Change(ByVal Target As Excel.Range
If Not Intersect(Target, Range("A1:AZ39")) Is Nothing The
With Range("A1:AZ39"
If IsNumeric(.Value) The
Select Case .Valu
Case Is > 1.
.Interior.ColorIndex = 5 'blu
Case Is >=
.Interior.ColorIndex = 10 'gree
Case Is >= 0.9
.Interior.ColorIndex = 46 'orang
Case Els
.Interior.ColorIndex = 2 'whit
End Selec
Els
.Interior.ColorIndex = xlColorIndexNon
End I
End Wit
End I
End Su

I still get nothing -
Should I get rid of the conditional formattin
 
Am still in need for some direction when running visual basic script for the preceding questions - any ideas?
 
Back
Top