Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Select Case within IF-Else statement

Sorry, I posted the wrong code. When I run this code, the SELECT CASE
line gives me an error.
'-------------------------------------------------
Sub colors()


Dim iRow As Long
Dim iCol As Long


For iRow = Range("F7").Row To Range("R42").Row Step 7
For iCol = Range("F7").Column To Range("R42").Column Step 2
doRange Cells(iRow, iCol)
Next iCol
Next iRow


End Sub

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Case Statement Katie Excel Worksheet Functions 13 December 1st 08 07:32 PM
select case statement jrd269[_4_] Excel Programming 4 June 3rd 05 04:22 PM
Select Case Statement does not evaluate Jeff[_44_] Excel Programming 11 April 6th 05 09:32 PM
Convert If..Else to Select Case Statement. Sheela Excel Programming 1 July 25th 03 09:28 AM
Data validation with the Select Case statement acw Excel Programming 0 July 15th 03 03:16 AM


All times are GMT +1. The time now is 11:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"