laurenh345
New Member
- Joined
- Mar 13, 2020
- Messages
- 19
- Office Version
- 2007
- Platform
- Windows
Hello!
I have the following macro I use to print every tab in a worksheet to a separate pdf. There are over 150 tabs in my sheet that I want to group when printing so I was hoping to be able to incorporate an item in the macro that if cell "B1" is "Ortho" then the tab will print. If that condition does not exist on that tab it will not print. Thanks so much for any help with this, I am new to VBA.
Sub ExportToPDFs()
' PDF Export Macro
' Change C:\Exports\ to your folder path where you need the diles saved
' Save Each Worksheet to a separate PDF file.
Dim ws As Worksheet
For Each ws In Worksheets
ws.Select
nm = ws.Name
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="P:\RVUs\" & nm & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Next ws
End Sub
I have the following macro I use to print every tab in a worksheet to a separate pdf. There are over 150 tabs in my sheet that I want to group when printing so I was hoping to be able to incorporate an item in the macro that if cell "B1" is "Ortho" then the tab will print. If that condition does not exist on that tab it will not print. Thanks so much for any help with this, I am new to VBA.
Sub ExportToPDFs()
' PDF Export Macro
' Change C:\Exports\ to your folder path where you need the diles saved
' Save Each Worksheet to a separate PDF file.
Dim ws As Worksheet
For Each ws In Worksheets
ws.Select
nm = ws.Name
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="P:\RVUs\" & nm & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Next ws
End Sub