Jimmypop
Well-known Member
- Joined
- Sep 12, 2013
- Messages
- 753
- Office Version
- 365
- Platform
- Windows
Good day all
Some assistance required...
I have the following code...
Now... How can I update the code to have it select only the visible cells on Sheet1 and the entire Sheet2 and then export to pdf... Currently it exports the entire Sheet1 but would like to have it export only the visible cells and not the hidden ones on Sheet1... So in essence:
1. Select visible cells Sheet1
2. Select entire Sheet2
3. Export the selection to a pdf...
Thanks in advance
Some assistance required...
I have the following code...
VBA Code:
Sub Export_To_PDF()
Dim WBName, FilePath As String
WBName = ActiveWorkbook.Name
FilePath = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & WBName & ".pdf"
MsgBox "This report will now be published To your Desktop As a .pdf File", vbInformation, "Message from Admin..."
ThisWorkbook.Sheets(Array("Sheet1", "Sheet2")).Select
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=FilePath, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
Worksheets("Sheet1").Select
End Sub
Now... How can I update the code to have it select only the visible cells on Sheet1 and the entire Sheet2 and then export to pdf... Currently it exports the entire Sheet1 but would like to have it export only the visible cells and not the hidden ones on Sheet1... So in essence:
1. Select visible cells Sheet1
2. Select entire Sheet2
3. Export the selection to a pdf...
Thanks in advance