Sequential Numbers

slimpickens

New Member
Joined
Feb 17, 2002
Messages
35
Is there anyway I can have a textbox register the next available number after each transaction is updated.

Thanks

Carol
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Mark,
In actual fact the reference number should be six digits long but the first five numbers should be 35001 while the last digit starts with 0. Every transaction after that should have 35001 and the next number until you reach 9. The next transaction after 350019 should change the 35001 to 35002 and start the sixth number with 0 again. I seem to be reaching for the stars here since my knowledge of Vb is limited, but I thought maybe someone could help me.

Carol
 
Upvote 0
Hi Carol.
The concept of what you need to accomplish seems easy enough, but to encourage people on this board to reply with working examples, please give as much detail as you are willing to give...

Ex.

I have a textbox(named) on sheet(named) which tracks numbers in Column(Label) beginning at row(Number).

Just an example.
We have not a clue as to where your data is coming from or going to????

Thanks,
Tom
This message was edited by TsTom on 2002-04-09 10:25
 
Upvote 0
My apologies,

I have a textbox(refnumber) on my Userform claim) in a wrksheet(Payments). I have made up a list of numbers in a next wrksheet(numbers) which I have in Column A beginning at row(2). There are other controls which would make up a claim transact"ion so that when I click on my "Add Record button all the data would be sent to the wrksheet(Payments). When my message box asks "do you want to add another record", I want the form to return with the next available number registered in textbox (refnumber) or if the user closes the form and reopens it, I want the next available number to be registered.

Hope this is enough info.

Carol
 
Upvote 0
On 2002-04-09 10:50, slimpickens wrote:
My apologies,

I have a textbox(refnumber) on my Userform claim) in a wrksheet(Payments). I have made up a list of numbers in a next wrksheet(numbers) which I have in Column A beginning at row(2). There are other controls which would make up a claim transact"ion so that when I click on my "Add Record button all the data would be sent to the wrksheet(Payments). When my message box asks "do you want to add another record", I want the form to return with the next available number registered in textbox (refnumber) or if the user closes the form and reopens it, I want the next available number to be registered.

Hope this is enough info.

Carol

Hi Carol,

In your UserForm initialize event, search the column of numbers for the maximum and add 1.

--------------------
Private Sub UserForm_Initialize()
Dim maxval
maxval = WorksheetFunction.Max(Sheets("Sheet1").Range("A:A")) + 1
UserForm1.TextBox1.Text = maxval
End Sub
-------------------

I am unsure of all the sheet/range references, so the code above only uses a generic Sheet1, Column A. Please adjust to fit your actual worksheet.

HTH,
Jay
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,530
Members
448,969
Latest member
mirek8991

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