VBA Copy Multiple Sheets Data to Binary File

unknownymous

Board Regular
Joined
Sep 19, 2017
Messages
249
Office Version
  1. 2016
Platform
  1. Windows
Hi Guys,


I have excel reference file named as Monthlies xxxx.xls format. Note that xxxx = date which changes every week. The file has 6 Tabs (Sheet 1-6). I need to convert the file first in binary then consolidated Sheet 1-5 on Sheet 1 as it normally consists of 300K lines when combined but I can't find any relevant code so I was thinking save a blank binary excel file on my desktop which will serve as the template.

Is there any easy way on how can I consolidate the 5 sheet tabs from the reference file and copy it to the binary excel template, replicate and rename the same as the reference file?




Any help will be much appreciated


Thank you!
 
.
Refer to this resource :

https://www.get-digital-help.com/2015/01/27/save-selected-sheets-to-a-pdf-file/


Code:
Sub SaveSelectedSheetsToPDF()
Dim str As String, myfolder As String, myfile As String
 
str = "Do you want to save these sheets to a single pdf file?" & Chr(10)
For Each sht In ActiveWindow.SelectedSheets
str = str & sht.Name & Chr(10)
Next sht
 
answer = MsgBox(str, vbYesNo, "Continue with save?")
If answer = vbNo Then Exit Sub
 
With Application.FileDialog(msoFileDialogFolderPicker)
.Show
myfolder = .SelectedItems(1) & "\"
End With
 
myfile = InputBox("Enter filename", "Save as..")
 
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
myfolder & myfile _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
 
End Sub



Make sure you select the sheets you want to save as a single pdf file before you run the macro. Press and hold CTRL and then left click with mouse on multiple sheets to select them.
 
Upvote 0

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.

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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