I need help with a macro that Saves file in PDF, auto-increments the #, and clears contents in certain cells. I'm running it by inserting a button and assigning macro to it
The idea is to make it look like this: JT-0416-001 (THIS IS MY MAIN PROBLEM)
and when I run the macro it should clear the contents in certain cells and change the number to JT-0416-002, and so on.
Also, for the next month, it should automatically change to JT-0516-001.
This is what I currently have:
Your help is greatly appreciated.. Thanks!
__________________________________________________________________
The idea is to make it look like this: JT-0416-001 (THIS IS MY MAIN PROBLEM)
and when I run the macro it should clear the contents in certain cells and change the number to JT-0416-002, and so on.
Also, for the next month, it should automatically change to JT-0516-001.
This is what I currently have:
Code:
Sub NextNumber()
Range("I6").Value = Range("I6").Value + 1
Range("A17:J33").ClearContents
Range("A10:D15").ClearContents
Range("F10:L15").ClearContents
End Sub
Sub SaveInvAsPDF()
Dim NewFN As Variant
NewFN = "C:\Users\......." & Range("I6").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=NewFN, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
NextNumber
End Sub
Your help is greatly appreciated.. Thanks!
__________________________________________________________________
Mod edit : thread moved to appropriate forum !