I am looking to create a macro that will allow me to toggle between a range of background colors of a selected range of cells, using the same key stroke, but run them separately, and run them in a loop. For example, I would like to hit Ctrl + Shift + C with the following outputs: First Time = Dark Blue, Second Time = Light Blue, Third Time = Grey, Fourth Time = Yellow, Fifth Time = No Fill, Nth Time = keep togging through.
I can get it all to run through once, but I do not know how to have them run separately, using the same key strokes, and toggle through each case.
Any help is very much appreciated!
Code Is below
- Code: Select all
Sub AllCellFill()
CellFill1
CellFill2
CellFill3
CellFill4
CellFill5
End Sub
Sub CellFill1()
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub
Sub CellFill2()
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
End Sub
Sub CellFill3()
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent1
.TintAndShade = 0.599993896298105
.PatternTintAndShade = 0
End With
End Sub
Sub CellFill4()
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub
Sub CellFill5()
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub