Hello guys,

I need help on one VBA that prints the workbook on PDF in the directory where the Excel file is located, using the name of a specific cell... It works perfect, the only think is that it prints all the worksheets instead of a specific one that I want, named "Tecnico" in this case. I am completely ignorant using VBA macros, but use Excel a lot.

Could you please give me some advice to make it printing only a single work sheet or even a specific range of cells?,

Thanks,

Sub TecnicoPDF()
Dim ws As Worksheet
Dim savefile As String
Dim scripttorun As String
' this is the sheet to save
Set ws = ActiveSheet
' use same folder as active workbook using file name in A1 on sheet1
savefile = ActiveWorkbookPath & Application.PathSeparator & Sheets("Tecnico").Range("x1").Value & ".PDF"
' save sheet as pdf
scripttorun = scripttorun & "tell application " & Chr(34) & _
"Microsoft Excel" & Chr(34) & Chr(13)
scripttorun = scripttorun & "save active workbook in (" & _
Chr(34) & savefile & _
Chr(34) & ") as PDF file format" & Chr(13)
scripttorun = scripttorun & "end tell" & Chr(13)
MacScript (scripttorun)
End Sub