VBA to Hide Columns quit working

Kevin_W

New Member
Joined
Aug 23, 2018
Messages
13
I have a file that has several toggle buttons to hide various columns. Its been working great. Within the past few days they just quit working. No error message and nothing changed in the file. I have other VBA in the file that does some other functions and they are working fine. Just the Hide/Unhide columns not working.

Any ideas as to what is going on here?

Here is the code I'm using:

Private Sub ToggleButton1_Click() 'Hide Segment 1'
Dim xAddress As String
xAddress = "S:U"
If ToggleButton1.Value Then
Application.ActiveSheet.Columns(xAddress).Hidden = True
Else
Application.ActiveSheet.Columns(xAddress).Hidden = False
End If
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try
Code:
Private Sub ToggleButton1_Click()
    ActiveSheet.Range("S:U").EntireColumn.Hidden = ToggleButton1.Value
End Sub
Is there any posibility that you changed the name of the toggle button. And/or made a duplicate toggle button.
Have you set a break-point to see if the button is calling the sub?
 
Upvote 0
Same thing happens with your code. I did start a brand new file and used your code and my original code. Both do not work. I do see that I had a Office 365 update last week. Maybe something in that is the issue?

Weird part is that when I click on the button a second smaller replica of the button appears above to the left of my button.
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

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