Macro to hide rows

  • Thread starter Thread starter Dick Stumbo
  • Start date Start date
D

Dick Stumbo

I have an excel template with 20 worksheets. I want to make
an election on the 2nd sheet in a specified cell of either
1, 2, 3, 4 or 5. With this election I want to be able to
hide specified rows on other worksheets and unhide any
previously hidden rows on the other workshhets.

I'd appreciate any ideas.
 
Here are some ideas
Here is one I once used to hide a column, for a SHAPE. Guess it could be
shortened?

Sub HideG_UnhideG()' Assigned to a shape
If Columns("g").EntireColumn.Hidden = True Then
Columns("g").EntireColumn.Hidden = False
ActiveSheet.Shapes("toggleit").Select
Selection.Characters.Text = "HIDE G" & Chr(10) & "" & Chr(10) & ""
Range("c3").Select
Else
Columns("g").EntireColumn.Hidden = True
ActiveSheet.Shapes("Toggleit").Select
Selection.Characters.Text = "SHOW G" & Chr(10) & "" & Chr(10) & ""
End If
Range("c3").Select

'can use =not if only ONE change.....
'Columns("g").EntireColumn.Hidden = Not Columns("g").EntireColumn.Hidden
End Sub
====
more
Private Sub ToggleButton1_Click()
If ToggleButton1.Value = True Then
Sheets(3).Visible = xlVeryHidden
ToggleButton1.Caption = "Unhide Sheet3"
Else
Sheets(3).Visible = True
ToggleButton1.Caption = "Hide Sheet3"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top