Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide unhide non-contiguous columns
I use the following code to hide/unhide a range of cells using a tick box
With Columns("O:W") .Hidden = Not .Hidden End With I want to do exactly the same for columns G,J,P,R ie if they are hidden then unhide them, if they are not hidden then hide them Any help appreciated |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide unhide non-contiguous columns
Try this
If Not Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden Then Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden = True End If Mike "Saintsman" wrote: I use the following code to hide/unhide a range of cells using a tick box With Columns("O:W") .Hidden = Not .Hidden End With I want to do exactly the same for columns G,J,P,R ie if they are hidden then unhide them, if they are not hidden then hide them Any help appreciated |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide unhide non-contiguous columns
How do I unhide them using the same control?
"Mike H" wrote: Try this If Not Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden Then Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden = True End If Mike "Saintsman" wrote: I use the following code to hide/unhide a range of cells using a tick box With Columns("O:W") .Hidden = Not .Hidden End With I want to do exactly the same for columns G,J,P,R ie if they are hidden then unhide them, if they are not hidden then hide them Any help appreciated |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide unhide non-contiguous columns
Sub togglehiddencolumns()
Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden = Not _ Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Saintsman" wrote in message ... I use the following code to hide/unhide a range of cells using a tick box With Columns("O:W") .Hidden = Not .Hidden End With I want to do exactly the same for columns G,J,P,R ie if they are hidden then unhide them, if they are not hidden then hide them Any help appreciated |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide unhide non-contiguous columns
Hi,
This makes it into a toggle of hide/unhide If Not Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden Then Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden = True Else Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden = False End If Mike "Saintsman" wrote: How do I unhide them using the same control? "Mike H" wrote: Try this If Not Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden Then Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden = True End If Mike "Saintsman" wrote: I use the following code to hide/unhide a range of cells using a tick box With Columns("O:W") .Hidden = Not .Hidden End With I want to do exactly the same for columns G,J,P,R ie if they are hidden then unhide them, if they are not hidden then hide them Any help appreciated |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide unhide non-contiguous columns
Thanks to all of you - lots of options for me to pick from
Saintsman "Don Guillett" wrote: OR Sub togglehiddencolumns() With Range("G:G,J:J,P:P,R:R").EntireColumn .Hidden = Not .Hidden End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Don Guillett" wrote in message ... Sub togglehiddencolumns() Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden = Not _ Range("G:G,J:J,P:P,R:R").EntireColumn.Hidden End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Saintsman" wrote in message ... I use the following code to hide/unhide a range of cells using a tick box With Columns("O:W") .Hidden = Not .Hidden End With I want to do exactly the same for columns G,J,P,R ie if they are hidden then unhide them, if they are not hidden then hide them Any help appreciated |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hide/Unhide columns using button on top over relevant columns | Excel Discussion (Misc queries) | |||
I set up a macro to hide/unhide columns. It hides more columns | Excel Programming | |||
Hide non-contiguous columns | Excel Programming | |||
Hide and unhide columns | Excel Programming | |||
hide / unhide columns | Excel Programming |