View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Select Case within IF-Else statement

You code works for me. EXACTLY what error do you get?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"rwnelson" wrote in message
oups.com...
Sorry, I posted the wrong code. When I run this code as is,
the SELECT
CASE line gives me an error.


'-----------------------------------------------------------------------
Sub doRange(rngTopLeft As Range)

With rngTopLeft.Resize(7, 2)
If rngTopLeft.Value < Date Then
.Interior.Pattern = xlGray50
Else
.Interior.Pattern = xlSolid
End If

If rngTopLeft.Value = 1 And rngTopLeft.Interior.ColorIndex
= 15
Then
Select Case Weekday(rngTopLeft.Value)
Case 1, 7 'Sunday or saturday
.Interior.ColorIndex = 37
Case Else
.Interior.ColorIndex = 40
End Select
End If

If rngTopLeft.Value = "" Then
.Interior.ColorIndex = 15
End If
End With

End Sub
'-------------------------------------------------------------------------