Selecting multiple sheets with defined ranges

anshul1719

New member
Joined
Jul 26, 2016
Messages
2
Reaction score
0
Points
0
Sheets("Sheet1").Range("A1:B29").ExportAsFixedFormat Type:=xlTypePDF, _


In sheet 1 the Range is -




Code:
Columns("C:G").Hidden = True
        Sheets("Sheet1").Range("A1:I107").ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:="C:\Documents\" & strFileName, _
        OpenAfterPublish:=True
Columns("C:G").Hidden = False


I believe I can use UNION function here -

Code:
Set y = Application.Union(Range("A1:B107"), Range("H1:I107"))

but not sure how to use it in this code and if this is correct! How do I get something like -

Code:
Set y = Application.Union(Range("A1:B107"), Range("H1:I107"))
Sheets("Sheet1").Range("y").ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="C:\Documents\" & strFileName, _
OpenAfterPublish:=True


Here it is, skipping the columns C:G as desired.
How do I get something like -


Worksheets((("Sheet1").Range("y of Sheet1")) And (("Sheet2").Range("A1.C15")) And (("Sheet3").Range("A1.D13"))). ExportAsFixedFormat Type:=xlTypePDF, _


Also, Sheet1 = Page 1 of PDF
Sheet 2 = Page 2 of PDF
Sheet 3 = Page 3 of PDF
 
try instead of
Code:
Sheets("Sheet1").Range("y").ExportAsFixedFormat Type:=xlTypePDF, _ 
Filename:="C:\Documents\" & strFileName, _ OpenAfterPublish:=True
have:
Code:
y.ExportAsFixedFormat Type:=xlTypePDF, _ 
Filename:="C:\Documents\" & strFileName, _ OpenAfterPublish:=True
 
Back
Top