Toggle (Show / Hide) rows

Brass Contributor

Hi Everyone,

 

Would like to know, how to create a toggle button in which it will show or hide a set of rows similar to below:

 

rbalza_0-1625706731100.png

 

3 Replies

@rbalza 

To do that, select the cells with similar items, go to Data Tab --> Under Outline group, click on Group and choose Rows.

Please refer to the screenshot below

 

Group Rows.jpg

Hi, apologies for not being clear. It is something like a button. I used vba however, is there anyway like it is using a cell itself not a button? Here's my code.

Private Sub ToggleButton1_Click()
Dim xCells As String
xCells = "1:15" 'change this to the row numbers

If ToggleButton1.Value Then
Application.ActiveSheet.Rows(xCells).Hidden = "True"
ToggleButton1.Caption = "+"
Else
Application.ActiveSheet.Rows(xCells).Hidden = "False"
ToggleButton1.Caption = "-"
End If
End Sub



Why not upload a sample file to know what you already have and what exactly you are trying to achieve? Don't forget to add the comments in the file itself to describe the end result you are trying to achieve.