S
sloan.fader
learning VBA and Macros in Excel, so forgive my newbie-ness.
I have two button forms, each with it's own macro.
Sub Button8_Click()
Range("J2:Q2").Select
Selection.EntireColumn.Hidden = True
End Sub
Sub Button9_Click()
Range("I2:R2").Select
Selection.EntireColumn.Hidden = False
Range("G2").Select
End Sub
One button(8) hides columns, the other button(9) reveals them. Is
there a simple bit of code that will allow me to combine these
functions onto one button? The macro that runs on click would depend on
the state of the sheet. If columns are hidden, the button would run
the "unhide" macro; if columns are unhidden, the button would run the
"hide" macro.
Also, as a nice touch, the button text would change to reflect
appropriate pending action.
This is, I guess, a basic on/off situation, but I can't figure it out.
I have two button forms, each with it's own macro.
Sub Button8_Click()
Range("J2:Q2").Select
Selection.EntireColumn.Hidden = True
End Sub
Sub Button9_Click()
Range("I2:R2").Select
Selection.EntireColumn.Hidden = False
Range("G2").Select
End Sub
One button(8) hides columns, the other button(9) reveals them. Is
there a simple bit of code that will allow me to combine these
functions onto one button? The macro that runs on click would depend on
the state of the sheet. If columns are hidden, the button would run
the "unhide" macro; if columns are unhidden, the button would run the
"hide" macro.
Also, as a nice touch, the button text would change to reflect
appropriate pending action.
This is, I guess, a basic on/off situation, but I can't figure it out.