I have a macro to export certain sheets in a workbook to separate PDF's (for reporting purposes). It works properly for me in one workbook, however, in a different workbook it is exporting ALL sheets. I can't figure out where I am going wrong. To make things easier, I italicized the spots where I would customize it for my purposes.
Sub ExportToPDFs()
' PDF Export Macro
' C:\ *location*
' Sheets(Array("*selected sheets*")).Select
Dim nm As String
Dim ws As Worksheet
For Each ws In Worksheets
ws.Select
nm = ws.Name
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="C:\*location*" & "*Report Title*" & nm & Range("D8").Value & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
Next ws
End Sub
For Each ws in Worksheets. This loops through each worksheet in the workbook and exports it. - Kyle