Install Button that toggles between hiding and unhiding certain columns

redbarnxoxo1

New Member
Joined
Jul 12, 2012
Messages
2
Could someone please respond to an ignorant Excel User with steps to:

1) Install a button
2) The macro behind the button needs to hide columns D, F, H, J
3) The same botton if pushed again unhides D, F, H, J


Please respond with step by step, I am not a smarty.

Thanks so much
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Welcome to the Board!

You can use:

<font face=Calibri><SPAN style="color:#00007F">Sub</SPAN> ToggleColumns()<br>    Range("D:D, F:F, H:H, J:J").EntireColumn.Hidden = <SPAN style="color:#00007F">Not</SPAN> Range("D:D, F:F, H:H, J:J").EntireColumn.Hidden<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>

Open the VBE with ALT+F11, then Insert-->Module, paste the above in and exit back to Excel with ALT+Q.

Then you can draw a shape, and when you're done, right-click, choose Assign Macro and select "ToggleColumns".

That's all there is to it.

HTH,
 
Upvote 0

Forum statistics

Threads
1,216,180
Messages
6,129,342
Members
449,505
Latest member
Alan the procrastinator

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top