Forum Discussion
rbalza
Jul 08, 2021Brass Contributor
Toggle (Show / Hide) rows
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:
3 Replies
Sort By
- Subodh_Tiwari_sktneerSilver Contributor
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
- rbalzaBrass ContributorHi, 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- Subodh_Tiwari_sktneerSilver ContributorWhy 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.