I have the following code that used to (Excel 2003) select any sheet with a tab color that matches the fill color of a certain cell (TabColor in the code).
Private Sub PrintTabs_Click() Dim wks As Worksheet Dim TabColor As Long Dim PrintSheets As String TabColor = Sheets("_Options_").Range("TabColor").Interior.Color 'Tab Color to Print (Points to a cell with a user defined color) For Each wks In Worksheets If wks.Tab.Color = TabColor Then wks.Select False End If Next wks ActiveWindow.SelectedSheets.PrintPreview End Sub
Now (Excel 2013), it does not select anything at all, unless I remove the "False" after the .Select. I also tried "Replace:=False" with the same results. When anything regarding the "False" is removed, the final result will be that the last sheet that meets the criteria will be selected. I would like all sheets that match the color to be selected.
Any help would be appreciated.
Thank you,
Mark
Bookmarks