I am trying to create a macro that will toggle through the following year formats - 2021, 2021A (actual), 2021E (expected)
I have used similar VBA to create macros to toggle number formats but the below VBA is not working. The initial change from whatever format to 2021A works but if I use the macro again, I do not get to 2021E. I appreciate any help on what I am doing incorrectly here. Thank you!
VBA code:
Sub YearToggle()
'
' YearToggle Macro
'
' Keyboard Shortcut: Ctrl+g
'
Select Case Selection.NumberFormat
Case "#A"
Selection.NumberFormat = "#E"
Case "#E"
Selection.NumberFormat = "#"
Case Else
Selection.NumberFormat = "#A"
End Select
End Sub
I have used similar VBA to create macros to toggle number formats but the below VBA is not working. The initial change from whatever format to 2021A works but if I use the macro again, I do not get to 2021E. I appreciate any help on what I am doing incorrectly here. Thank you!
VBA code:
Sub YearToggle()
'
' YearToggle Macro
'
' Keyboard Shortcut: Ctrl+g
'
Select Case Selection.NumberFormat
Case "#A"
Selection.NumberFormat = "#E"
Case "#E"
Selection.NumberFormat = "#"
Case Else
Selection.NumberFormat = "#A"
End Select
End Sub