Page 1 of 1

how to increment invoice num with prefix

Posted: Tue Sep 29, 2020 5:38 pm
by sna
Hi Dear
I need your help how to increment invoice number thru textbox with prefix
Here is my code:

Code: Select all

Private Sub UserForm_Initialize()
Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("Accounts Receivable")
'find last row in database
irow = ws.Cells(Rows.Count, 1).End(xlUp).Row
TextBox1.Value = "INV-"& ws.Cells(irow, 1) + 1
End Sub

Best Regards

Re: how to increment invoice num with prefix

Posted: Tue Sep 29, 2020 10:55 pm
by snasui
:D I can't find any error of your code.

Re: how to increment invoice num with prefix

Posted: Tue Sep 29, 2020 11:26 pm
by sna
I want it to show INV-001,INV-002 etc

Re: how to increment invoice num with prefix

Posted: Wed Sep 30, 2020 8:39 am
by snasui
:D Please attach the example file and point to the problem.