So in an example code like below, it works in PDFing specific sheets in an excel by specifying the sheet #, but is there a way to specify PDF range by Sheet name instead of number?
Sub createPdf()
Dim SheetArr() As String
Dim i As Integer
Dim startSheet As Integer
Dim endSheet As Integer
startSheet = 1
endSheet = 2
Dim folderPath As String
folderPath = "C:\Users\xxxx\Desktop\Pdfs" 'change to your
user.
MkDir (folderPath)
For Each ws In ThisWorkbook.Worksheets 'This statement
starts the loop
If ws.Index >= startSheet And ws.Index <= endSheet Then ' <>
"Sheet3" Then
ReDim Preserve SheetArr(i)
SheetArr(i) = ws.Name
i = i + 1
Debug.Print (ws.Name)
End If
Next
Sheets(SheetArr).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF,
Filename:=folderPath & "\Sales", _
openafterpublish:=False, ignoreprintareas:=False
MsgBox "All done with pdf's"
End Sub