Grouping worksheets

tartanthing

New Member
Joined
Mar 4, 2022
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
I have a whole series of worksheets in a single workbook split in to groups then sub groups. EG Main Worksheet will be 1000 to 2000 with several hundred entries per worksheet going up in increments of 100, so the next group will be 1100, 1200, 1300 etc. those are then split further into 1100.1, 1100.2, 1100.3.
I've seen other workbooks (sorry, tried to find an example I thought I had downloaded) where the only tabs you see are 1100,1200,1300. When you click on a tab-eg 1100 it expands to reveal 1100.1,1100.2,110.3 etc, click on the 1100 tab again and it all contracts and hides the sub groups.
I cant for the life of me find a way to describe this in search which doesn't give me a video or tutorial telling me about groups and altering data. That's not what I want. I just want to clock on a tab and have the next worksheets expand or contract back to the main sheet.
Can someone please help, preferably without VBA? I need to be able to send this off to others to use without having to doomscroll through each open tab to find the right one.
Thanks for your help!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
You could set up scripts in each of your tabs that when the tab is selected it will show all sub tabs and hide subs from other main tabs. So while activating the tab will display what you want...in order for it to be hidden again, you'll need to select another tab. For example:

Private Sub worksheet_activate()
'replicate this line for subsheets to be displayed
Sheet6.Visible = xlSheetVisible
'replicate this line for subs from other tabs to be hidden
Sheet12.Visible = xlSheetHidden
End Sub

Unfortunately, I think VBA is your only option here...
 
Upvote 0
Another option...which feels a bit more clunky to me, but does work, is:

Private Sub worksheet_beforerightclick(ByVal target As Range, cancel As Boolean)
If Sheet6.Visible = xlSheetHidden Then
Sheet6.Visible = xlSheetVisible
' sheet 7.visible = xlSheetVisible
' etc
Else
Sheet6.Visible = xlSheetHidden
' sheet 7.visible = xlSheetHidden
' etc
End If
End Sub

This way, the user can right click anywhere on the sheet and it will toggle hiding and unhiding the subsheets for that section.
 
Upvote 0
Or you could just use a shape/button on each sheet which just calls one macro, rather than having loads of event code.
 
Upvote 0
You could set up scripts in each of your tabs that when the tab is selected it will show all sub tabs and hide subs from other main tabs. So while activating the tab will display what you want...in order for it to be hidden again, you'll need to select another tab. For example:

Private Sub worksheet_activate()
'replicate this line for subsheets to be displayed
Sheet6.Visible = xlSheetVisible
'replicate this line for subs from other tabs to be hidden
Sheet12.Visible = xlSheetHidden
End Sub

Unfortunately, I think VBA is your only option here...
I'll give this a try cheers. Will update if successful!
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,546
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top