Hello Guys ,
i have this VBA code that generates auto invoice number , i could not change the code so that it increment the left 3 numbers by 1 , and check if month and year are correct
my invoice number is : 001/mm/yyyy , 001 is the reference of the invoice
Sub NextInvoice()
OldInvoice = Range("G2").Value
LeftDate = Left(OldInvoice, 5)
CurrDate = UCase(Format(Date, "mm/YY"))
If LeftDate = CurrDate Then
Range("G2").Value = CurrDate & _
Format(Right(OldInvoice, 3) + 1, "000")
Else
Range("G2").Value = CurrDate & "001"
End If
Range("C16:G55").ClearContents
End Sub
thanks team
i have this VBA code that generates auto invoice number , i could not change the code so that it increment the left 3 numbers by 1 , and check if month and year are correct
my invoice number is : 001/mm/yyyy , 001 is the reference of the invoice
Sub NextInvoice()
OldInvoice = Range("G2").Value
LeftDate = Left(OldInvoice, 5)
CurrDate = UCase(Format(Date, "mm/YY"))
If LeftDate = CurrDate Then
Range("G2").Value = CurrDate & _
Format(Right(OldInvoice, 3) + 1, "000")
Else
Range("G2").Value = CurrDate & "001"
End If
Range("C16:G55").ClearContents
End Sub
thanks team