Counted how many sheets are to be saved

KlausW

Active Member
Joined
Sep 9, 2020
Messages
378
Office Version
  1. 2016
Platform
  1. Windows
Hi I have a little challenge. I use this VBA code to store a number of sheets in PDF, and it will be counted how many sheets are to be saved by sheet Bestilling cell F1. And it works really well.

Now I really want it to be counted together how many sheets are to be saved by sheet Ekstra, the page number is in cell I1 sheet Ekstra.

Someone who can help. All help will be appreciated.

Best regards Klaus W

I got this help earlier

VBA Code:
Sub Rektangelafrundedehjørner1_Klik()
Dim saveLocation As String
Dim sheetArray As Variant

saveLocation = "C:\Users\k-wit\Documents\Bestilling af proviant\" & Sheets("Indkøbsrekvisition").Range("m1").Value & ".pdf"
sheetArray = Array("Bestilling", "Indkøbsrekvisition", "Ekstra")

'Select specific sheets from workbook, the save all as PDF
Sheets(sheetArray).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
    Filename:=saveLocation, From:=1, To:=Sheets("Bestilling").Range("F1").Value + 2
    
   Sheets("Indkøbsrekvisition").Select
 Mail_workbook_Outlook
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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