I create a daily summary report each day that includes a pivot table with several worksheets based on filter pages within the pivot table. The pivot table includes a worksheet called "Executive Speeding Report" and "PT". Essentially the Executive Speeding Report worksheet contains the "raw" data while the "PT" worksheet is the pivot table portion of the workbook. The filter pages contain details exclusively to each division impacted by the summary report--these worksheets are labeled "Div. 041", "Div. 062", "Div. 089" based on driving behavior the previous day (see attached image). This daily workbook could contain as many as 30 worksheets or as few as 1 during each daily download.
Can someone help me add VBA to apply this conditional formatting macro to each worksheet in the workbook except the worksheet labeled "Executive Speeding Report"?
Dim myWB As Workbook
Dim myWS As Worksheet
Dim FirstCell, myRows, myColumns, myUsedRange As Range
Set myWB = ActiveWorkbook
Set myWS = myWB.ActiveSheet
Set FirstCell = myWS.Cells(5, 1)
Set myRows = myWS.Cells(Rows.Count, 1).End(xlUp).Rows
Set myColumns = myWS.Cells(5, Columns.Count).End(xlToLeft).Columns
Set myUsedRange = myWS.Range(myRows, myColumns)
Application.ScreenUpdating = False
myUsedRange.Select
myUsedRange.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND(TEXT($D5,""hh:mm:ss"")>""00:01:01"",OR(ISNUMBER(SEARCH(""6-"",$E5)),ISNUMBER(SEARCH(""7-"",$E5)),ISNUMBER(SEARCH(""9-"",$E5))),NUMBERVALUE(TEXT($G5,""##""))>63)"
With Selection.FormatConditions(1).Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
Cells.Select
Cells.EntireColumn.AutoFit
Application.ScreenUpdating = True
Range("A1").Select
End Sub
Can someone help me add VBA to apply this conditional formatting macro to each worksheet in the workbook except the worksheet labeled "Executive Speeding Report"?
Dim myWB As Workbook
Dim myWS As Worksheet
Dim FirstCell, myRows, myColumns, myUsedRange As Range
Set myWB = ActiveWorkbook
Set myWS = myWB.ActiveSheet
Set FirstCell = myWS.Cells(5, 1)
Set myRows = myWS.Cells(Rows.Count, 1).End(xlUp).Rows
Set myColumns = myWS.Cells(5, Columns.Count).End(xlToLeft).Columns
Set myUsedRange = myWS.Range(myRows, myColumns)
Application.ScreenUpdating = False
myUsedRange.Select
myUsedRange.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND(TEXT($D5,""hh:mm:ss"")>""00:01:01"",OR(ISNUMBER(SEARCH(""6-"",$E5)),ISNUMBER(SEARCH(""7-"",$E5)),ISNUMBER(SEARCH(""9-"",$E5))),NUMBERVALUE(TEXT($G5,""##""))>63)"
With Selection.FormatConditions(1).Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
Cells.Select
Cells.EntireColumn.AutoFit
Application.ScreenUpdating = True
Range("A1").Select
End Sub