Following is the code that gets generated when you record a macro to export excel to pdf.
Recorded Code :
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\users\Desktop\macros\filename.pdf", Quality _
:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Update Code to get the filename from cell S2:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
**Range("S2").Value** & ".pdf", Quality _
:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True