I am trying to run a macro to edit a table's formatting including table totals. Some tables do not have table totals and this is creating an error. How do I insert an is error inside my code?
Code:
Range("A2").Select
ActiveSheet.ListObjects("Table1").TableStyle = "TableStyleMedium8"
Range("Table1[#Headers]").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 192
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.Font.Bold = True
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Range("Table1[#Totals]").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 192
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Selection.Font.Bold = True