PDA

View Full Version : Excel question


Tom
11-04-2015, 01:15 PM
I have two button on a workbook. The to one hides certain columns from view, while the bottom one restores the full worksheet.

My ???? is, how do I set this up, and what is it called?
Hard to search for it when you have no idea what to call it.

Saratoga_Mike
11-04-2015, 01:36 PM
Click on the "Data" Tab at the top of Excel. Select "Group." I believe that's what you're looking for.

Tom
11-04-2015, 02:03 PM
Bingo!

Thanks Mike.

raybo
11-04-2015, 09:03 PM
You could have also "recorded" a macro for the top button, by starting the record, manually selecting the columns to hide, using the "Ctrl" plus mouse click until all are selected, then right click any of the selected columns and select "Hide", then stop the record. Then assign that recorded macro to the top button by right clicking it and selecting "Assign macro" and selecting that macro. Then for the bottom button, you could have selected a column range that includes all the hidden columns, by clicking a column to the left of the 1st hidden column and holding the click while dragging the cursor to the right across the columns, to the right of the last hidden column, then right click any of those selected columns and select "Unhide", then assign that macro to the bottom button.

I find that most times it's just quicker and easier to record macros (if possible), by performing all the steps you need, manually, and then just assigning it to a button. You can always open the macro code window (by right clicking the button and selecting "Assign macro" and clicking "Edit") and modify the code by adding "Application.ScreenUpdating = False" before the body of the code, to speed up the macro by not visually showing all the separate steps while it's running, but rather only the start and finish of the macro. If you have to scroll during the record, all those scrolls will occupy lines in the code and will be shown visually as it runs, but you can go to the code and select those scrolling lines, right click those highlighted lines and select "Cut", so you wouldn't see the scrolling action, you'd just see the starting location and the ending location, much cleaner and faster running macro. Trying to find an option in the menu/ribbon that does exactly what you want can be time consuming (if even possible), unless you get lucky and find it quickly.

Of course, some actions that you may want to automate, can't be recorded, but must be hand written in the code window. That's a different ballgame.