Forum Discussion
Jon_Morgan1958
Sep 24, 2023Copper Contributor
Select Worksheets by Tab Colour
Hi. I need some help please? My file is organised by WSheet Tab Colour. I need to be able to select all by Tab Colour or some other criteria. Alternately by some other method such as creating a list and then selecting that list to loop thru.
Any help much appreciated.
Regards
Jon
Perhaps something like this?
Sub Test() LoopTabColor Color:=vbYellow End Sub Sub LoopTabColor(Color As Long) Dim wsh As Worksheet For Each wsh In Worksheets If wsh.Tab.Color = Color Then ' Do something with this sheet Debug.Print wsh.Name End If Next wsh End Sub
2 Replies
Sort By
Perhaps something like this?
Sub Test() LoopTabColor Color:=vbYellow End Sub Sub LoopTabColor(Color As Long) Dim wsh As Worksheet For Each wsh In Worksheets If wsh.Tab.Color = Color Then ' Do something with this sheet Debug.Print wsh.Name End If Next wsh End Sub
- Jon_Morgan1958Copper ContributorBrilliant thanks Hans.