![]() |
Second Click on Control Button
Greetings!
I made a control button that will unhide a column in a certain range using: Private Sub CommandButton2_Click() Columns("B").Select Selection.EntireColumn.Hidden = False Range("B1").Select End Sub How can I modify this to re-hide the column on the second click, or if it his already unhidden? |
Second Click on Control Button
Private Sub CommandButton2_Click()
With Columns(2) .EntireColumn.Hidden = Not .EntireColumn.Hidden End With Range("B1").Select End Sub Gord Dibben MS Excel MVP On Tue, 1 Aug 2006 14:30:02 -0700, iamjbunni wrote: Greetings! I made a control button that will unhide a column in a certain range using: Private Sub CommandButton2_Click() Columns("B").Select Selection.EntireColumn.Hidden = False Range("B1").Select End Sub How can I modify this to re-hide the column on the second click, or if it his already unhidden? |
Second Click on Control Button
Private Sub CommandButton2_Click()
With Columns("B") .Hidden = Not .Hidden End With Range("B1").Select End Sub -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "iamjbunni" wrote in message ... Greetings! I made a control button that will unhide a column in a certain range using: Private Sub CommandButton2_Click() Columns("B").Select Selection.EntireColumn.Hidden = False Range("B1").Select End Sub How can I modify this to re-hide the column on the second click, or if it his already unhidden? |
Second Click on Control Button
Give this a try...
Private Sub CommandButton2_Click() With Columns("D") If .Hidden = True Then CommandButton2.Caption = "Hide Column" .Hidden = False Else CommandButton2.Caption = "Un-Hide Column" .Hidden = True End If End With End Sub -- HTH... Jim Thomlinson "iamjbunni" wrote: Greetings! I made a control button that will unhide a column in a certain range using: Private Sub CommandButton2_Click() Columns("B").Select Selection.EntireColumn.Hidden = False Range("B1").Select End Sub How can I modify this to re-hide the column on the second click, or if it his already unhidden? |
Second Click on Control Button
Thank you!
"Gord Dibben" wrote: Private Sub CommandButton2_Click() With Columns(2) .EntireColumn.Hidden = Not .EntireColumn.Hidden End With Range("B1").Select End Sub Gord Dibben MS Excel MVP On Tue, 1 Aug 2006 14:30:02 -0700, iamjbunni wrote: Greetings! I made a control button that will unhide a column in a certain range using: Private Sub CommandButton2_Click() Columns("B").Select Selection.EntireColumn.Hidden = False Range("B1").Select End Sub How can I modify this to re-hide the column on the second click, or if it his already unhidden? |
All times are GMT +1. The time now is 05:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com