Code numbering invoice

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
1,507
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
hi, expert
i have userform connect with sheet i would show the next number in textbox3
the textbox3 connected with range in my sheet f9 i know this code range("f9").value=range("f9").value+1
but my numbering is coplicated contains letters and numbers and symbols here my numbring is bsjd-001
i hope help me
 
Hello. If your numbering always ends with the number you want to add to, then this will do it. Replace the bsjd- with another text if necessary.
Code:
Dim Prefixtext As String
Prefixtext = "bsjd-"
Range("f9").Value = Prefixtext + Format(Mid(Range("F9").Value, Len(Prefixtext) + 1) + 1, "000")
This will always add 1 to the number at the end and keep it as 3 digits (i.e. 002,003 etc) (and when it gets to 999 it will carry on with 1000, 1001, etc.. If there may be text after the number, then a more complicated solution is needed.

I have been looking for a solution to my invoicing issue and this helped me greatly. I had to tweek it slightly for my use, but this worked for my needs. Thanks!!
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top