Forum Discussion
Pierre59
Aug 14, 2021Copper Contributor
Programming button funktion in Excel sheet
Hi, I want to add a button function that opens or closes certain predefined rows or columns in my Excel sheet. I need this help as soon as possible. Thank you Pierre59
HansVogelaar
Aug 14, 2021MVP
For example, create a macro
Sub ToggleRows11To20()
Range("A11:A20").EntireRow.Hidden = Not Range("A11").EntireRow.Hidden
End Sub
Insert a button from the Form Controls section of the Controls dropdown on the Developer tab of the ribbon, and assign the above macro to it.
You can modify the macro as needed.