Having trouble with Code #1 below, I'm trying to just create a simple macro for my use case as described below. I am running into an issue where xlCenterAcrossSelection command is getting reset after it gets applied. I've run through the F8 Step Into Debug and it looks like CenterAcrossSelection ALWAYS breaks at the END IF argument highlighted blue/bold below in my code (i.e. it will apply correctly in the code then when it reaches ENDIF, the horizontalalignment gets reset to xlCenter). Any idea how to fix this? I strangely enough have another keyboard shortcut assigned to Code #2 that works perfectly for just this issue.
Use case: when I make a selection (say 3 cells - A1:C1 where A1 has "the" in it and B1 / C1 are empty), then running this macro toggles between State 1 [CenterAcrossSelection, bolded, and underlined accounting style] and State 2 [all cells are back to center aligned in A1:C1, not centered across selection, no underline accounting style].
Code #1 that isn't working as it should be for a style switch across selection
Code #2 that works perfectly for just alternating between CenterAcrossSelection and not
Bookmarks