Increment Form and Revision Number with Hyphen in Between.

USFengBULLS

Board Regular
Joined
May 7, 2018
Messages
66
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am looking at many examples online on how to auto increment Invoice / Form number but they aren't specific to what I need to do.
The format to number my forms is (Change Order #) - (Revision #). Example, If I were on the fourth revision of change order three, it would be 3-4.
I need to write two codes for two different situations.

The first code needs to increment the change order number, the value to the left side of the hyphen i.e. 1-0, 2-0, 3-0, 4-0

The second code will need to increment the revision number, the value to the right side of the hyphen i.e. 1-1, 1-2, 1-3, 1-4

I had 1-0 in the cell to test and wrote a simple Range("B7") = Range("B7") + 1 and of course it did not work. I already have a place to put these codes that resets the form depending on if its a new change order, or a revision to a change order. I just need some help with the actual code that would increment the number to left only or the number on the right only.
How would I write the code for both of these?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi,

Is this what you mean:


Book1
ABCD
1Left onlyRight only
21-02-01-1
Sheet512
Cell Formulas
RangeFormula
C2=LEFT(A2,FIND("-",A2)-1)+1&MID(A2,FIND("-",A2),99)
D2=LEFT(A2,FIND("-",A2))&MID(A2,FIND("-",A2),99)+1
 
Upvote 0
Yes, Exactly. But I need it to do this in two separate VBA Codes so I can have it run with other codes/events that I already have happening.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
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