View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default hide and show columns using one control button

Actually, I misunderstood what you were trying to do. I now see you are
picking the rows on each side of F and I to do the unhide.

Try this instead:

Sub Hide_TY()
Dim btn As Button
Set btn = ActiveSheet.Buttons(Application.Caller)
If Range("I1").EntireColumn.Hidden = False Then
Range("F1,I1").EntireColumn.Hidden = True
btn.Caption = "Show F and I"
Else
Range("F1,I1").EntireColumn.Hidden = False
btn.Caption = "Hide F and I"
End If
End Sub

--
Regards,
Tom Ogilvy


"dreamkeeper" wrote in message
oups.com...
Thank you Tom but I amhaving trouble interpretting the code to the real
spreadsheet.
I want to be able to hide and show and hide again etc.

Would you mind if I sent you the spreadsheet to look? I

Actually it is more complicated since the columns I want to hide/unhide
are also involved in an outline of grouped columns that I can
collapse.

any input would be greatly appreciated
thanks!
Tina