How do I auto number cells in an Excel template?

G

Guest

I created a template for a purchase order in Excel. Everytime someone opens
the template, I would like one cell to be automatically numbered in a
sequential pattern. That way each time the template is used, it will have
it's own unique number that will be used to identify it. Does anyone know if
this is possible for Excel 2000?

Thanks!
 
J

Jason Morin

You could add a 1 to Sheet1!A1 each time the workbook is
opened. Press ALT+F11, double-click the "ThisWorkbook"
module under View>Project Explorer and paste in:

Sub Workbook_Open()
With Sheets("Sheet1").[A1]
.Value = .Value + 1
End With
ActiveWorkbook.Save
End Sub
 
G

Guest

Hello,

Your suggestion didn't work for me. Can you help me figure out if I did
something wrong? I did all the steps as you suggested, closed MS visual
basic and returned to excel. When I reopened the file, it said that there
was an error and would I like to debug. When I said yes, it took me to
visual basic and highlighted the line:
With sheets("Sheet1").[A1]

Thinking that the problem is that I want to auto number cell A2, not A1, I
changed the cell number and saved. This kept me from having messages saying
I need to debug, but didn't make the spreadsheet automatically number itself
each time it is opened.

Thanks for any help you can offer!

Natalie

Jason Morin said:
You could add a 1 to Sheet1!A1 each time the workbook is
opened. Press ALT+F11, double-click the "ThisWorkbook"
module under View>Project Explorer and paste in:

Sub Workbook_Open()
With Sheets("Sheet1").[A1]
.Value = .Value + 1
End With
ActiveWorkbook.Save
End Sub

--
HTH
Jason
Atlanta, GA

-----Original Message-----
I created a template for a purchase order in Excel. Everytime someone opens
the template, I would like one cell to be automatically numbered in a
sequential pattern. That way each time the template is used, it will have
it's own unique number that will be used to identify it. Does anyone know if
this is possible for Excel 2000?

Thanks!
.
 
P

Paul B

Natalie, you said you are using a template, .xlt and not a .xls file, if
that is the case you will need to use something like the examples here

http://www.mcgimpsey.com/excel/udfs/sequentialnums.html

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

Natalie said:
Hello,

Your suggestion didn't work for me. Can you help me figure out if I did
something wrong? I did all the steps as you suggested, closed MS visual
basic and returned to excel. When I reopened the file, it said that there
was an error and would I like to debug. When I said yes, it took me to
visual basic and highlighted the line:
With sheets("Sheet1").[A1]

Thinking that the problem is that I want to auto number cell A2, not A1, I
changed the cell number and saved. This kept me from having messages saying
I need to debug, but didn't make the spreadsheet automatically number itself
each time it is opened.

Thanks for any help you can offer!

Natalie

Jason Morin said:
You could add a 1 to Sheet1!A1 each time the workbook is
opened. Press ALT+F11, double-click the "ThisWorkbook"
module under View>Project Explorer and paste in:

Sub Workbook_Open()
With Sheets("Sheet1").[A1]
.Value = .Value + 1
End With
ActiveWorkbook.Save
End Sub

--
HTH
Jason
Atlanta, GA

-----Original Message-----
I created a template for a purchase order in Excel. Everytime someone opens
the template, I would like one cell to be automatically numbered in a
sequential pattern. That way each time the template is used, it will have
it's own unique number that will be used to identify it. Does anyone know if
this is possible for Excel 2000?

Thanks!
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top