Forum Discussion
Celia9
Jul 07, 2022Brass Contributor
VBA to dynamic toggle columns hide/unhide
Hi, I have a VBA to toggle my columns hide/unhide Private Sub ToggleButton1_Click() Dim xAddress As String xAddress = "F:G" If ToggleButton1.Value Then Application.ActiveSheet.Columns(xAdd...
Celia9
Jul 11, 2022Brass Contributor
Sure, here it is!
https://www.dropbox.com/scl/fi/67r1ud35dkez5nazhal48/Planninglist-buttons.xlsm?dl=0&rlkey=hza0srmr05dot4vntjoizxsth
Thank you!
https://www.dropbox.com/scl/fi/67r1ud35dkez5nazhal48/Planninglist-buttons.xlsm?dl=0&rlkey=hza0srmr05dot4vntjoizxsth
Thank you!
HansVogelaar
Jul 11, 2022MVP
Thanks, that helped. See the attached version. I added 5 command buttons.
- Celia9Jul 11, 2022Brass Contributor
Thank you so much!
- HansVogelaarJul 11, 2022MVP
The line
Range("C1").Resize(1, LastColumn - 5).EntireColumn.Hidden = Truehides all columns in the used range except for the first two and the last three. In the sample workbook, the data extend from column A to column R, so columns C to O get hidden, while columns A, B, P, Q and R will always remain visible.
- Celia9Jul 11, 2022Brass ContributorThis is amazing!!!
I cleaned up your version, I also have M6, so when I filter, I do not see the last 3 columns anymore (workorder, description ann location)
Where in the code can I find this option?
And also, how can I thank you for all your help? Is there something I can sponsor or something like that?