How do I set-up automatic number generation in Excel?

G

galaxykid

I have a form setup in Excel. I want to add an automatic number generation
field to this form. Is that possible and how do I do this?

The form was originally developed in Excel (Office XP). My users are using
Office 2000.
 
G

Guest

assuming that u want sequential numbering...
two ways i can think of.
1.put the number on a sheet and have code call the number
to the form. for next number, have code add 1 to the to
the number on the sheet.
2. put a hidden lable on the form. put the number in the
lable's caption. have code call the lable's caption to the
text box. for next number have code add 1 to the label's
caption.
 
G

galaxykid

This sounds great! But I am not an excel pro. Can you give me some pointers
on how to intragrate.

Thanks in advance for the tip
 
G

Guest

hi again
i don't know how you are set up nor what you are doing so
this is just sample code. tested on you play form. it works
but i would set it up so that adding 1 to the lable
caption occurs after you have complete what ever it is you
are doing in the form. this is to prevent loosing numbers.
with a form i assume you are entering data and populating
a database.
so call the label caption with line 1 below. enter you
data into the form. if you add the data to your db then
add 1 to the label caption. if you don't add the form data
then don't add 1 to the label caption.
good luck.
Private Sub CommandButton1_Click()
Me.TextBox1 = Me.Label1.Caption
Me.Label1.Caption = Me.TextBox1 + 1
End Sub
 
Top