G
GK80535
Thanks for the reply.
I've tried the temporary variable thing, but it doesn't seem to b
working for me. It seems like the current font color and font bol
state aren't being stored into the variables correctly. I'm not sur
why. Here's the code (FontColor and FontBold are the temporar
variables I'm using):
' Toggles the background color
' Keyboard Shortcut: Ctrl+Shift+O
Sub BackgroundToggle()
Dim FontColor, FontBold
FontColor = Selection.Font.Color()
FontBold = Selection.Font.Bold()
If Selection.Interior.ColorIndex = xlNone Then
Selection.Interior.ColorIndex = 2
ElseIf Selection.Interior.ColorIndex = 2 Then
Selection.Interior.ColorIndex = 1
Selection.Font.Color = RGB(255, 255, 255)
Selection.Font.Bold = True
ElseIf Selection.Interior.ColorIndex = 1 Then
Selection.Interior.ColorIndex = 48
Selection.Font.Color = RGB(255, 255, 255)
Selection.Font.Bold = True
ElseIf Selection.Interior.ColorIndex = 48 Then
Selection.Interior.ColorIndex = 35
Selection.Font.ColorIndex = 1
Selection.Font.Bold = True
Else
Selection.Interior.ColorIndex = xlNone
Selection.Font.Bold = FontColor
Selection.Font.Color = FontColor
End If
End Sub
Any suggestions
I've tried the temporary variable thing, but it doesn't seem to b
working for me. It seems like the current font color and font bol
state aren't being stored into the variables correctly. I'm not sur
why. Here's the code (FontColor and FontBold are the temporar
variables I'm using):
' Toggles the background color
' Keyboard Shortcut: Ctrl+Shift+O
Sub BackgroundToggle()
Dim FontColor, FontBold
FontColor = Selection.Font.Color()
FontBold = Selection.Font.Bold()
If Selection.Interior.ColorIndex = xlNone Then
Selection.Interior.ColorIndex = 2
ElseIf Selection.Interior.ColorIndex = 2 Then
Selection.Interior.ColorIndex = 1
Selection.Font.Color = RGB(255, 255, 255)
Selection.Font.Bold = True
ElseIf Selection.Interior.ColorIndex = 1 Then
Selection.Interior.ColorIndex = 48
Selection.Font.Color = RGB(255, 255, 255)
Selection.Font.Bold = True
ElseIf Selection.Interior.ColorIndex = 48 Then
Selection.Interior.ColorIndex = 35
Selection.Font.ColorIndex = 1
Selection.Font.Bold = True
Else
Selection.Interior.ColorIndex = xlNone
Selection.Font.Bold = FontColor
Selection.Font.Color = FontColor
End If
End Sub
Any suggestions