Giving a form a unique ID number

stimey89

New Member
Joined
Feb 19, 2010
Messages
10
I have created a form that when printed will be used as a rejection tag for isolating damaged or on-hold parts. Each tag that is printed must have a unique ID number. Is there a way to have excel automatically populate a field, giving each saved/printed tag a unique ID?

For example, I open the workbook and it automatically populates the ID field as #1, and then locks that field as #1 when I perform a saveas.

The next time I open the original workbook, it automatically populates the ID field as #2, and then locks that field as #2 when I perform a savas.

Thanks in advance for any help that can be offered.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I take it you mean VBA form? And you already seem to have the right means for doing this on the spreadsheet itself, based on your question

simply save the latest form value into a named range, cell, or name within your spreadsheet, then retrieve it each time the form loads.
 
Upvote 0
sorry, I should always take two attempts to understand these questions... it always looks different second time I read it

You probably want to use the worksheet open and worksheet before close events in VBA
1) name a range in your workbook, "IDtracker"
2) Right click your sheettab and select "view code"
3) in the VBA screen, find ThisWorkbook on the left, and double click

Paste the code

Private Sub Workbook_Open()
Range("IDtracker").Value = Range("IDtracker").Value + 1
End Sub
 
Upvote 0
Thanks for your replies baitmaster. I'm sorry I didn't reply sooner, but I got pulled off of this project and never had a chance to try your tips on the form I was working on.

I appreciate you taking the time to respond and again, I'm sorry I didn't reply sooner.
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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