savePDF excel sheet

Code

Sub SavePDF()

Dim saveLocation As String
Dim rng As Range


saveLocation = Range("g5").Value & ".pdf"
Set rng = Sheets("INVOICE").Range("A1:H30")
rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=saveLocation
ActiveSheet.PrintOut preview:=True


Range("g5").Value = Range("g5").Value + 1
Range("b8:d8").ClearContents
Range("b12:b21").ClearContents
Range("d12:d21").clearncontents

End Sub

Leave a Reply