View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
lharthur lharthur is offline
external usenet poster
 
Posts: 3
Default toggle button in excel

Thanks Himani... it helps me on how to program the button.. But I do not
have consecutive rows data that I need to hide.. it represents my biggest
problem...
Because the sheet is being updated by adding information when I use the
upperleft 1,2 button it will hide or unhide all the information.

"Himani" wrote:

See code below..

Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Hide" Then
Columns("G:G").Select
Selection.EntireColumn.Hidden = True
CommandButton1.Caption = "UnHide"
Else
Columns("G:G").Select
Selection.EntireColumn.Hidden = False
CommandButton1.Caption = "Hide"
End If
End Sub
------------------------------------------------------------------

"lharthur" wrote:

I would like to use a toggle button to hide and unhide several columns and
rows.
The first thing I did was to create 2 macros 1 to hide and other to unhide.
But now I would like to link those macros in a toggle button. I have tried
but no results. Is any idea around? Thanks