View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
rwnelson rwnelson is offline
external usenet poster
 
Posts: 24
Default Select Case within IF-Else statement

I'm trying to edit the following code but when I put the Select Case
after Then instead of after Else, it gives me an error. Why would it
work for one but not the other? I'm a VBA beginner.


If rngTopLeft.Value = "" Then
.Interior.ColorIndex = 15
Else
'color blue/beige (37 for weekend, 40 for weekday)
Select Case Weekday(rngTopLeft.Value)
Case 1, 7 'Sunday or saturday
.Interior.ColorIndex = 37
Case Else
.Interior.ColorIndex = 40
End Select
End If