Created
September 20, 2012 08:41
-
-
Save brymck/3754702 to your computer and use it in GitHub Desktop.
Color all cell background and foreground indices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For when you want to preserve color indices when saving from Excel 2007+ to | |
' .xls format. Copy into PERSONAL.XLS or your worksheet and run with | |
' Alt+F11, Ctrl+G, ColorCells() | |
Private Const StartRow As Integer = 2 | |
Private Const StartCol As Integer = 2 | |
Private Const LastColorIndex As Integer = 56 | |
Public Sub ColorCells() | |
Dim i As Integer | |
Dim Row As Integer | |
For i = 0 To LastColorIndex | |
Row = i + StartRow | |
Cells(Row, StartCol).Interior.ColorIndex = i | |
Cells(Row, StartCol + 1).Font.ColorIndex = i | |
Next i | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment