Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I'm trying to write a Macro that toggles through background color an font styles. No one's been able to help me out from my previous posts, so I'm stil searching. I need a function that returns the current selection's font style (red italic, bold, times roman, etc.) so that I can store it in a variabl before my toggle begins and so that I can restore the style at the en of my toggle. Can anyone please help me out with this? Here's my code: ' Toggles the background color ' Keyboard Shortcut: Ctrl+Shift+O Sub BackgroundToggle() 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 = False Selection.Font.ColorIndex = 1 End If End Su -- GK8053 ----------------------------------------------------------------------- GK80535's Profile: http://www.excelforum.com/member.php...fo&userid=1546 View this thread: http://www.excelforum.com/showthread.php?threadid=27213 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Changing font style and color using VBA | Excel Discussion (Misc queries) | |||
Change the Font Style in VBA | Excel Discussion (Misc queries) | |||
How to write a formula to set the Font Style? | Excel Discussion (Misc queries) | |||
font style of worksheet functions | Excel Worksheet Functions | |||
Icon button - font/style | Excel Discussion (Misc queries) |