View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default 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