Sub PDF_Click()
On Error Resume Next
If Not Application.Version > 11.9 Then
Resp = MsgBox("Need to use Excel 2007 or later for this!!", vbOKOnly, "Sorry!")
On Error GoTo 0
Exit Sub
End If
'Set the path to PDF folder -- edit to suit
MyPath = ThisWorkbook.Path & "\PDFs" 'Same path as the xl file in a subfolder PDFs
MyName = ThisWorkbook.Name
MyName = Left(MyName, InStr(1, MyName, ".") - 1) & ".pdf"
'*** edit out this message if not required
Resp = MsgBox("You will find the PDF file within the folder named 'PDFs'" & Chr(13) & MyPath, _
vbOKOnly, "Creating PDF File")
'******************
Application.ScreenUpdating = False
MkDir MyPath 'folder will be created if not exist otherwise error ignored
Kill MyPath & "\" & MyName 'file will be deleted and overwritten if exist otherwise error ignored
ThisWorkbook.Sheets(Array("Results", "Chart")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
MyPath & "\" & MyName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Sheets("Data").Select
On Error GoTo 0
End Sub