If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Macro to hide rows
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. |
#2
|
|||
|
|||
Macro to hide rows
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 -- HTH. Best wishes Harald "Dick Stumbo" wrote in message ... 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. |
Thread Tools | |
Display Modes | |
|
|