Use the below vbscript..
Private Sub CommandButton1_Click()
'BUTON CONVERSIE PDF - ANGAJATORI
'DESCRIPTION: CONVERSIE A UNUI SHEET IN PDF
Dim ThisRng As Range
Dim strfile As String
Dim myfile As Variant
'Selectie Sheet pentru conversie
Application.ScreenUpdating = False
ActiveWorkbook.Sheets("PDF ANG").Visible = True
'Selectie filtru pentru ce sa converteasca
ActiveWorkbook.Sheets("PDF ANG").Select
Selection.AutoFilter Field:=1, Criteria1:="<>" 'column A
Selection.AutoFilter Field:=5, Criteria1:="<>" 'column E
'Selectie raza pentru conversie
With ActiveWorkbook.Sheets("PDF ANG")
Set ThisRng = .Range("A2", .Cells(.Rows.Count, "F").End(xlUp))
End With
'Prompt for save location
strfile = "Selection" & "_" _
& Format(Now(), "yyyymmdd_hhmmss") _
& ".pdf"
strfile = ThisWorkbook.Path & "\" & strfile
myfile = Application.GetSaveAsFilename _
(InitialFileName:=strfile, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and File Name to Save as PDF")
If myfile <> "False" Then 'save as PDF
ThisRng.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
myfile, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
Else
MsgBox "No File Selected. PDF will not be saved", vbOKOnly, "No File Selected"
End If
ActiveWorkbook.Sheets("PDF ANG").ShowAllData
ActiveWorkbook.Sheets("PDF ANG").Visible = False
End Sub