collating worksheets with the same tab colour

fry

Active Member
Joined
Apr 25, 2007
Messages
411
Can anyone suggest the best way to do this.

I'd like to assign the code to a button so that when pressed only the tabs of a specific colour appear in the workbook (in this case dark green (colour 10) and blue (colour 32).

Having done that I'd have to add a button to get back to normal which in my case is showing worksheets with only green (colour 43) and yellow (colour 6) tabs

Any help much appreciated :)
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try:
Sub HideUndhide_Click()
Dim curWorksheet As Worksheet
For Each curWorksheet In ThisWorkbook.Worksheets
If curWorksheet.Tab.ColorIndex = 10 Then
curWorksheet.Visible = False
End If
Next
End Sub
You should of course modify this VBA text to suit your specific requirements...
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,082
Members
453,021
Latest member
Justyna P

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