jongnj87
New member
- Joined
- Apr 7, 2021
- Messages
- 1
- Reaction score
- 0
- Points
- 0
- Excel Version(s)
- Microsoft Officer 2019
Good Day All,
I am just curious whether am I able to auto generate invoice number based on actual date.
E.g. Today is 7 Apr 2021 and my Invoice number usually will be 202104070001(DDMMYYY0001)
My invoice number will be at "C5"
So I change it manually. My VBA already auto +1 when I save the invoice and is will save as the customer name "C9"
Anyone able to guide me on this please.
Thank You.
Below are my code for my invoice
I am just curious whether am I able to auto generate invoice number based on actual date.
E.g. Today is 7 Apr 2021 and my Invoice number usually will be 202104070001(DDMMYYY0001)
My invoice number will be at "C5"
So I change it manually. My VBA already auto +1 when I save the invoice and is will save as the customer name "C9"
Anyone able to guide me on this please.
Thank You.
Below are my code for my invoice
Code:
Private Sub CommandButton1_Click()
'for Final Words Strikethrough Range("D47").Font.Color = vbRed Range("D47").Font.Strikethrough = True
'for PDF Draft file save Sheet9.Range("A1:I51").ExportAsFixedFormat xlTypePDF, Filename:= _ "C:\Users\JOYCELYN SEE\Desktop\FENG YUN\RECEIPT\Draft PDF" & Sheet9.Range("C9").Value, OpenAfterPublish:=True
'for Final Word UnStrikethrough
Range("D47").Font.Color = vbBlack
Range("D47").Font.Strikethrough = False
'for xl file save ActiveSheet.Copy With ActiveWorkbook .SaveAs "C:\Users\JOYCELYN SEE\Desktop\FENG YUN\RECEIPT\Draft Receipt" & Sheet9.Range("C9").Value, FileFormat:=xlOpenXMLWorkbookMacroEnabled
'for Receipt number Sheet9.Range("C5").Value = Sheet9.Range("C5").Value + 1
'for clear receipt
Sheet9.Range("C9:I13").ClearContents
Sheet9.Range("B16:B35").ClearContents
Sheet9.Range("F16:F35").ClearContents
Sheet9.Range("G16:G35").ClearContents
End With
End Sub
Private Sub CommandButton3_Click()
'for Draft Word Strikethrough
Range("C47").Font.Color = vbRed
Range("C47").Font.Strikethrough = True
'for Final Word UnStrikethrough
Range("D47").Font.Color = vbBlack
Range("D47").Font.Strikethrough = False
'for PDF Final file save Sheet9.Range("A1:I51").ExportAsFixedFormat xlTypePDF, Filename:= _ "C:\Users\JOYCELYN SEE\Desktop\FENG YUN\RECEIPT\Fianl Receipt" & Sheet9.Range("C9").Value, OpenAfterPublish:=True
'for Draft Word UnStrikethrough
Range("C47").Font.Color = vbBlack
Range("C47").Font.Strikethrough = False
End Sub