VBA Button Keeps Disappearing

The Animal

Active Member
Joined
May 26, 2011
Messages
449
Hi
I have just created my first VBA to Hide and Un-hide columns as below in 2010

Sub ToggleExpandContract()
Range("A:C,F:F,H:J,X:X,Y:Y,AH:AJ").Columns.Hidden = Not Range("A:C,F:F,H:J,X:X,Y:Y,AH:AJ").Columns.Hidden
End Sub

Then I created a button and added it to my Quick Access Toolbar but the button keeps disappearing when I close the file and re-open the file so I have to keep re-creating the button.
What am I doing wrong?
Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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