How to Combine each Multiple Sheets to ONLY ONE PDF file?

buitrunghieu

New Member
Joined
Jul 14, 2022
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
The first, I am very sorry because I am not good at English. I have a problem. Please help me how to Combine Sheet "YCNT" and "NTXD" to ONE Pdf file. Just like Mail Merge in Microsoft Word when I "Finish & Merge" -> Merge to New Document -> From ... To ... -> So I have Only One Document to see. Thank you!

VBA Code:
Private Sub CommandButton1_Click()
On Error GoTo ex
Dim pr As Variant
Dim aShtLst As Variant
Dim OrigSheet As Variant
Dim ichg As Integer, i1 As Integer, i2 As Integer

aShtLst = Array("YCNT", "NTXD")
OrigSheet = ActiveSheet.Name
i1 = TextBox1.Value
i2 = TextBox2.Value
pr = Application.Dialogs(xlDialogPrinterSetup).Show
If pr = False Then Exit Sub
    For ichg = i1 To i2
        Range(RefEdit1).Formula = ichg
        Calculate
      [COLOR=rgb(44, 130, 201)]  ThisWorkbook.Sheets(aShtLst).PrintOut ActivePrinter:=pr, Copies:=TextBox3.Value
        Worksheets(OrigSheet).Select[/COLOR]
    Next
Unload Me
Exit Sub
ex:
MsgBox "ERORR"
End Sub


I do not know how to Merge all "aShtLst" when printed to PDF to ONLY ONE PDF file? Please!
 
Last edited by a moderator:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Record a macro whilst selecting the 2 sheets (grouped sheets) and saving the workbook as a PDF and it will generate the code you require.
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: How to Combine each Multiple Sheets to ONLY ONE PDF file?
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.


Also, when posting vba code in the forum, please use the available code tags. It makes your code much easier to read/debug. My signature block below has more details. I have added the tags for you this time.
 
Upvote 0

Forum statistics

Threads
1,214,877
Messages
6,122,051
Members
449,064
Latest member
scottdog129

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