LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default If Then Conditions

Hi Rudy
try the following:
Sub foo()
With Range("A1:G40").Font
Select Case Date
Case DateSerial(2004, 1, 1) To DateSerial(2004, 1, 31)
.ColorIndex = 3
Case DateSerial(2004, 2, 1) To DateSerial(2004, 2, 29)
.ColorIndex = 4
Case DateSerial(2004, 3, 1) To DateSerial(2004, 3, 31)
.ColorIndex = 5
Case DateSerial(2004, 4, 1) To DateSerial(2004, 4, 30)
.ColorIndex = 6
Case DateSerial(2004, 1, 1) To DateSerial(2004, 3, 31)
.ColorIndex = 3
End Select
End With
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany


Rudy Winter wrote:
This is the Macro I used:

If Date = 1 / 1 / 4 <= 1 / 31 / 4 Then
Range("A1:G40").Select
Selection.Font.ColorIndex = 3
End If
If Date = 2 / 1 / 4 <= 2 / 29 / 4 Then
Range("A1:G40").Select
Selection.Font.ColorIndex = 4
End If
If Date = 3 / 1 / 4 <= 3 / 31 / 4 Then
Range("A1:G40").Select
Selection.Font.ColorIndex = 5
End If
If Date = 4 / 1 / 4 <= 4 / 30 / 4 Then
Range("A1:G40").Select
Selection.Font.ColorIndex = 6
End If
End Sub

 
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
Countif Conditions - Use of conditions that vary by cell value JonTarg Excel Discussion (Misc queries) 1 May 30th 08 01:21 PM
2 Conditions + Sum of a colum matching those conditions Jeffa Excel Worksheet Functions 5 June 8th 07 12:14 AM
shade cells based on conditions - i have more than 3 conditions Mo2 Excel Worksheet Functions 3 March 30th 07 07:19 AM
sum on conditions..... pimar Excel Discussion (Misc queries) 6 May 31st 05 05:00 AM
How to multiple conditions to validate more than 2 conditions to . Bhuvana Govind Excel Worksheet Functions 1 January 28th 05 07:07 PM


All times are GMT +1. The time now is 05:48 AM.

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"