Hi
I use this code in module to add a conditional format to sheets:
It working fine, but it add CF to all existing sheets in the workbook.
Can someone change this part of code:
that will allow me:
Variant 1 - run code from a specific sheet till the end of workbook
Variant 2 - run code from a specific sheet to another specific sheet. For example run ONLY on 3 sheet "January 04-09", "January 11-16", "January 18-23" or from "January 04-09" till "January 18-23"
Thanks
I use this code in module to add a conditional format to sheets:
VBA Code:
Option Explicit
Sub RunCF()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Select
Range("$D$7:$H$12,$D$16:$H$21,$D$25:$H$30,$D$34:$H$39,$D$43:$H$48,$D$52:$H$54").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND(OR(D7=$H$3,D7=$H$3&""*"",D7=$H$3&""**""),D7>"""")"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
Selection.FormatConditions(1).StopIfTrue = False
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = RGB(0, 176, 240)
.TintAndShade = 0
End With
Next ws
End Sub
It working fine, but it add CF to all existing sheets in the workbook.
Can someone change this part of code:
Code:
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Select
that will allow me:
Variant 1 - run code from a specific sheet till the end of workbook
Variant 2 - run code from a specific sheet to another specific sheet. For example run ONLY on 3 sheet "January 04-09", "January 11-16", "January 18-23" or from "January 04-09" till "January 18-23"
Thanks