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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,993
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?
 

Kevin_W

New Member
Joined
Aug 23, 2018
Messages
13
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,309
Messages
5,641,448
Members
417,209
Latest member
Agbarker

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
Top