How to add automatic tracking number to a form

Vitas

New Member
Joined
Feb 26, 2002
Messages
9
Hello,

I'm trying to create an invoice form, and I want to assign automatic tracking number to the form every time it's filled up. How should I do it?
Could anybody help?

Vitas
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
MS should add this function to Excel, I bet someone asks for this code two or three times a week on this board. If I was sure the old board was added to the new board I would tell you just search for the code or function you like best, but since this is the new board, Try this code:

Private Sub Workbook_Open()
'By Joe Was, 2/2002.
'Place this code in the "ThisWorkbook" Module
'to increment on the opening of the workbook.

'Sub Worksheet_Activate()
'Use the "Activate" Sub in a Sheet Module
'to increment on a sheet selection.

[A3].Value = [A3] + 1
ActiveWorkbook.Save
MsgBox "Each time this sheet is opened" & Chr(13) & "the starting number is increased." _
& Chr(13) & "And this blank template is saved" & Chr(13) & _
"with the new starting number!" & Chr(13) & Chr(13) & _
"Please, save any added data" & Chr(13) & "with a new file Name!" & Chr(13) & Chr(13) & _
"To preserve system integrity" & Chr(13) & "follow these directions!"
End Sub

Hope this helps. JSW
 
Upvote 0
Adding automatic tracking number to a form

Ok, I found your explanation for this, but am slightly confused. We’re not sure where you’re supposed to put the code and I’m not sure I follow the rest of it either. Is there any way that you could possibly explain it in a version for not so literate computer people?
 
Upvote 0
Private Sub Workbook_Open()
'Place this code in the "ThisWorkbook" Module
'to increment on the opening of the workbook.

Sheets("Sheet1").Select

[A3].Value = [A3] + 1

ActiveWorkbook.Save

MsgBox "Each time this sheet is opened" & Chr(13) & "the starting number is increased." _
& Chr(13) & "And this blank template is saved" & Chr(13) & _
"with the new starting number!" & Chr(13) & Chr(13) & _
"Please, save any added data" & Chr(13) & "with a new file Name!" & Chr(13) & Chr(13) & _
"To preserve system integrity" & Chr(13) & "follow these directions!"
End Sub


"Sheets("Sheet1")" in this the name of the sheet that gets the updated number. You may need to change this to your sheets name!

Cell "A3" in the code above is the cell that gets the new number. You may need to change this to the cell address that gets this number.


On the sheet Tab, Right click select View code. In the VBA Editor on the you should have a "Project Explorer" open if not Mouse over the ToolBar icons to display each icon's name, look for "Project Explorer"

Double click the item in the Project Explorer called "ThisWorkbook"
In the code window that opens Paste a copy of the above code.

Click the upper most Right Close "x" to return to your sheet.
 
Upvote 0

Forum statistics

Threads
1,214,891
Messages
6,122,105
Members
449,066
Latest member
Andyg666

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