ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hide & unhide toggle button (https://www.excelbanter.com/excel-programming/447536-hide-unhide-toggle-button.html)

[email protected]

hide & unhide toggle button
 
Private Sub CommandButton1_Click()

Dim myRow As Long
Dim myAdr As String

myRow = ActiveCell.Row
myAdr = ActiveCell.Offset(0, -1).Address(0, 0)
Range("B" & myRow & ":" & myAdr).EntireColumn.Hidden = True
The macro above will hide COL B to any selected col
What can I add to thsi macro in order to toggle between hiding and unhiding that data.
Much appreciate your help

Ben McClave

hide & unhide toggle button
 
Hello,

I'd try just one small change to the line below:


Range("B" & myRow & ":" & myAdr).EntireColumn.Hidden = Not Columns("B").Hidden


[email protected]

hide & unhide toggle button
 
On Wednesday, October 31, 2012 3:26:28 PM UTC-4, wrote:
Private Sub CommandButton1_Click()



Dim myRow As Long

Dim myAdr As String



myRow = ActiveCell.Row

myAdr = ActiveCell.Offset(0, -1).Address(0, 0)

Range("B" & myRow & ":" & myAdr).EntireColumn.Hidden = True

The macro above will hide COL B to any selected col

What can I add to thsi macro in order to toggle between hiding and unhiding that data.

Much appreciate your help



[email protected]

hide & unhide toggle button
 
On Wednesday, October 31, 2012 3:26:28 PM UTC-4, wrote:
Private Sub CommandButton1_Click()



Dim myRow As Long

Dim myAdr As String



myRow = ActiveCell.Row

myAdr = ActiveCell.Offset(0, -1).Address(0, 0)

Range("B" & myRow & ":" & myAdr).EntireColumn.Hidden = True

The macro above will hide COL B to any selected col

What can I add to thsi macro in order to toggle between hiding and unhiding that data.

Much appreciate your help


Worked great Tank you very much


All times are GMT +1. The time now is 06:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com