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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Stephan Hoenselaar

New Member
Joined
Jul 11, 2007
Messages
40
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...
 

Forum statistics

Threads
1,181,373
Messages
5,929,571
Members
436,679
Latest member
helly123

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
Top