Last active
September 9, 2022 20:09
-
-
Save navmed/e6b8bbe160aa3933dec04f1acd97bbd7 to your computer and use it in GitHub Desktop.
Excel macro to switch the sheet between actual dark mode and light mode
This file contains 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 this to work create a file called "BlackBackground.jpg" in the path, with a full black image. It can be 1x1 pixels, but the size doesn't matter. | |
Sub Dark_mode() | |
' | |
' Dark_mode Macro | |
' | |
' Keyboard Shortcut: Ctrl+d | |
' | |
ActiveSheet.SetBackgroundPicture Filename:= _ | |
"BlackBackground.jpg" | |
Range("A1").Select | |
Range(Selection, Selection.End(xlToRight)).Select | |
Range(Selection, Selection.End(xlDown)).Select | |
With Selection.Font | |
.ThemeColor = xlThemeColorDark1 | |
.TintAndShade = 0 | |
End With | |
With Selection.Borders | |
' .Color = RGB(72, 72, 72) | |
End With | |
ActiveWindow.GridlineColor = RGB(0, 0, 0) | |
' ActiveWindow.DisplayGridlines = False | |
End Sub | |
Sub Light_mode() | |
' | |
' Dark_mode Macro | |
' | |
' Keyboard Shortcut: Ctrl+d | |
' | |
ActiveSheet.SetBackgroundPicture Filename:= _ | |
"" | |
Range("A1").Select | |
Range(Selection, Selection.End(xlToRight)).Select | |
Range(Selection, Selection.End(xlDown)).Select | |
With Selection.Font | |
.ThemeColor = xlThemeColorLight1 | |
.TintAndShade = 0 | |
End With | |
With Selection.Borders | |
' .LineStyle = xlNone | |
End With | |
ActiveWindow.GridlineColor = RGB(128, 128, 128) | |
' ActiveWindow.DisplayGridlines = True | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment