Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In row 5 (C5 - AF5) are dates from 1 - 31
Then from C8 - AG25 I will need the cells under the column for the weekends to be gray by macro. I have always used conditional formatting for this, but now I will have to use my three CF's for something other than specifying the weekends How do I put these CF's into a macro to format the cells light gray from C8 - AG25 ? If Formula is =WEEKDAY(E$5,2)=6 If Formula is =WEEKDAY(F$5,2)=7 etc |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I recorded a macro to make the active cell grey if E5 was a weekend. Here is
the result Sub Macro1() ' ' Macro1 Macro ' Macro recorded 12/01/2009 by Bernard V Liengme ' ' Selection.FormatConditions.Delete Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _ "=WEEKDAY(E$5,2)=6" Selection.FormatConditions(1).Interior.ColorIndex = 15 End Sub Using that as a guid I coded this Sub Macro2() With Range("G10") .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:= _ "=WEEKDAY(E$5,2)=6" .FormatConditions(1).Interior.ColorIndex = 15 End With End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Driftwood" wrote in message ... In row 5 (C5 - AF5) are dates from 1 - 31 Then from C8 - AG25 I will need the cells under the column for the weekends to be gray by macro. I have always used conditional formatting for this, but now I will have to use my three CF's for something other than specifying the weekends How do I put these CF's into a macro to format the cells light gray from C8 - AG25 ? If Formula is =WEEKDAY(E$5,2)=6 If Formula is =WEEKDAY(F$5,2)=7 etc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
use macro to copy formula with value and not formula without value | Excel Programming | |||
Formula in a macro | Excel Programming | |||
Formula in macro causes macro to fail | Excel Programming | |||
Macro Formula for Max value | Excel Worksheet Functions | |||
Formula expected end of statement error, typing formula into cell as part of VBA macro | Excel Programming |