Thread: Case Select
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Case Select

So do you want it to use the alternate range if there is (at least) one
instance of CAR, or every cell is CAR?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Kelly" wrote in message
...
Yes,The value in F1:IV1 will either be "CAR" or a numeric value.
Thanks for your help!
kelly


"Bob Phillips" wrote:

"Kelly" wrote in message
...
Hello
I am trying to modify existing code

On Error GoTo ws_exit:
Application.EnableEvents = False
For Each cell In Me.Range("F2:IV2")
Select Case UCase(cell.Value)
Case "Cat": ColorCell UCase(cell.Value), cell, 39
Case "Dog": ColorCell UCase(cell.Value), cell, 40
Case "Fish": ColorCell UCase(cell.Value), cell, 35
Case "Horse": ColorCell UCase(cell.Value), cell, 36
End Select
Next
WS_exit

The cases will be the same Cat,Dog,Fish,Horse.
However
if F1:IV1 = "CAR" me.range is F2:IV2 and
if F1:IV1= Numeric then me.range is F3:IV3


I am not sure what that means. Does F1:IV1 ="CAR" mean that every cell

is
that value?