VBA for printing multiple tabs excel for mac

EBahn

New Member
Joined
Mar 3, 2023
Messages
5
Office Version
  1. 2016
Platform
  1. MacOS
I have this:


Sub Button_Click()

Dim sheetname As String

sheetname = Application.InputBox("Enter a sheet name")

Sheets(sheetname).PrintOut



End Sub

And I want to print multiple tabs... preferably front and back..

In box would like to print for LS
1709306371517.png


Response below

1709306392410.png


1709306436549.png


Not sure how to amend this. I would like to have it print Manifest and one side and LS on other..

HELP?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try the following macro, capture the sheet names separated by commas. Check that the sheet name exists in your workbook.



VBA Code:
Sub Button_Click()
  Dim sheetname As Variant, sh As Variant
  Dim a()
  Dim n As Long
  
  sheetname = Application.InputBox("Enter a sheet name")
  
  If sheetname = "" Or sheetname = False Then Exit Sub
  
  For Each sh In Split(sheetname, ",")
    ReDim Preserve a(n)
    a(n) = Trim(sh)
    n = n + 1
  Next
  Sheets(a).PrintOut
End Sub
 
Upvote 0
Thank you much Dante, I did this and it seems to work. I thank you kindly. I would just change print properties to print front and back?
 
Upvote 0
Try the following macro, capture the sheet names separated by commas. Check that the sheet name exists in your workbook.



VBA Code:
Sub Button_Click()
  Dim sheetname As Variant, sh As Variant
  Dim a()
  Dim n As Long
 
  sheetname = Application.InputBox("Enter a sheet name")
 
  If sheetname = "" Or sheetname = False Then Exit Sub
 
  For Each sh In Split(sheetname, ",")
    ReDim Preserve a(n)
    a(n) = Trim(sh)
    n = n + 1
  Next
  Sheets(a).PrintOut
End Sub
 
Upvote 0
Thank you again Dante.... Works like a champ. I am much pleased. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,110
Messages
6,123,146
Members
449,098
Latest member
Doanvanhieu

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