Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 81
Default Print depending on tab colour

Is it possible to print only those tabs of a particular colour - say yellow?

Saintsman
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Print depending on tab colour

Try this:-

Sub selectiveprint()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Select
If ActiveSheet.Tab.ColorIndex = 6 Then
wSheet.PrintOut
End If
Next wSheet
End Sub


Mike


"Saintsman" wrote:

Is it possible to print only those tabs of a particular colour - say yellow?

Saintsman

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 81
Default Print depending on tab colour

Thanks - all I need to do is group the sheets for page numbering & I'm there

"Mike H" wrote:

Try this:-

Sub selectiveprint()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Select
If ActiveSheet.Tab.ColorIndex = 6 Then
wSheet.PrintOut
End If
Next wSheet
End Sub


Mike


"Saintsman" wrote:

Is it possible to print only those tabs of a particular colour - say yellow?

Saintsman

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Print depending on tab colour

Try this, I think you'll find it does the job for you. It does leave the
sheets with chosen color selected as a group.

Sub GroupSheetsByColorAndPrint()
'change ProperColor to color code you need
'13 is 'standard' yellow in Excel 2007
'6 is Yellow in earlier versions
'
'the array SheetsGroup() will always have
'an empty element as the last element,
'this code takes that into account
'
Const ProperColor = 6
Dim SheetsGroup() As String
Dim WS As Worksheet
ReDim SheetsGroup(1 To 1)
For Each WS In Worksheets
If WS.Tab.ColorIndex = ProperColor Then
SheetsGroup(UBound(SheetsGroup)) = WS.Name
ReDim Preserve SheetsGroup(1 To UBound(SheetsGroup) + 1)
End If
Next
If UBound(SheetsGroup) 1 Then
ReDim Preserve SheetsGroup(1 To UBound(SheetsGroup) - 1)
Sheets(SheetsGroup).Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1
End If
End Sub


"Saintsman" wrote:

Thanks - all I need to do is group the sheets for page numbering & I'm there

"Mike H" wrote:

Try this:-

Sub selectiveprint()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Select
If ActiveSheet.Tab.ColorIndex = 6 Then
wSheet.PrintOut
End If
Next wSheet
End Sub


Mike


"Saintsman" wrote:

Is it possible to print only those tabs of a particular colour - say yellow?

Saintsman

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Condition depending on tab colour excel Excel Worksheet Functions 3 July 15th 07 10:23 PM
colour of a row depending on cell value Maax Excel Discussion (Misc queries) 6 February 8th 07 05:30 PM
Can I filter a row depending on the colour that I've highlighted it with? Tricky Excel Discussion (Misc queries) 3 September 14th 06 05:12 PM
Background Colour Depending On Input Macca Excel Discussion (Misc queries) 1 April 30th 06 01:05 AM
Changing Colour of Bar depending on Value Campbell Charts and Charting in Excel 1 March 31st 06 01:16 PM


All times are GMT +1. The time now is 09:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"