ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hide-unhide (https://www.excelbanter.com/excel-programming/407934-re-hide-unhide.html)

eliano[_2_]

hide-unhide
 
Hi Hoy. :-)
For a very "personal" solution (no Button, etc), try:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Cancel = True

With ActiveSheet
If .Columns("c:t").Hidden = False Then
.Columns("c:t").Hidden = True
Else
.Columns("c:t").Hidden = False
End If
End With

End Sub

Saluti
Eliano



On 18 Mar, 19:37, hoysala wrote:
i have written the following code to hide a column

can anybody help me altering the program to swap between hide and
unhide using the same CommandButton ?

Private Sub CommandButton5_Click()

If ActiveSheet.Name = SHEETNAME Then

*If Worksheets(SHEETNAME).Columns("c:t").Hidden = False Then
* * *Worksheets(SHEETNAME).Columns("c:t").Hidden = True
* *End If

End If

End Sub




All times are GMT +1. The time now is 03:25 AM.

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