excel vba printing

kelvin_9

Active Member
Joined
Mar 6, 2015
Messages
444
Office Version
  1. 2019
Hello All,

can i add a command on printing with requirements as
on module1, tab color = 0, i just need to print 1 copies, one side printing for each sheet, no double side
on module2, tab color = 8, i need to print 2 copies, one side printing each sheet, no double side, uncollated

thank you very much

VBA Code:
Sub Macro1()
'
' Macro1 Macro
'

'

'NO FILL COLOR TAB

Dim ws As Worksheet
Dim strg() As String
Dim count As Integer
count = 1
 
    For Each ws In Worksheets
        If ws.Tab.Color = 0 And Not ws.CodeName = "Sheet1" And Not ws.CodeName = "sheet2" Then
            ReDim Preserve strg(count) As String
            strg(count) = ws.Name
            count = count + 1
        Else
        End If
    Next ws
    
    Sheets(strg(1)).Select
    For i = 2 To UBound(strg)
        Sheets(strg(i)).Select False
    Next i

End Sub
Sub Macro2()
'
' Macro2 Macro
'

'

'BLUE(8) COLOR TAB

Dim ws As Worksheet
Dim strg() As String
Dim count As Integer


ReDim strg(1 To Worksheets.count)
    For Each ws In Worksheets
        If (ws.Tab.ColorIndex = 8) And Not ws.CodeName = "Sheet1" And Not ws.CodeName = "sheet2" Then
            count = count + 1
            strg(count) = ws.Name
        Else
        End If
    Next ws
    
    If count = 0 Then
      MsgBox "NO EMPO ORDER"
      Exit Sub
    End If

    ReDim Preserve strg(1 To count)
    Sheets(strg).Select

End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,214,786
Messages
6,121,546
Members
449,038
Latest member
Guest1337

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