login register about faq

How to make Excel generate sequential serial numbers?

I'm trying to create a document in Excel that each time you open it, the serial number would be 1 higher. For instance the first time I open it, I'd want the number to be 00001, then 00002. But I don't want it as a list in Excel, I want it to be a new number each time I open the document. Like how you would have an invoice or a Bill of Lading as a different number.
more ▼

asked Jul 10 '12 at 02:54 PM

carla123 gravatar image

11 1 1 2

(comments are locked)
10|600 characters needed characters left

2 answers: sort voted first

Assuming your Serial number is in cell F3 you can use Excel's Auto_Open to call routine to increment that cell. Sample below:

Private Sub Auto_Open()  
     Call IncrementCounter  
End Sub

Sub IncrementCounter()   
     Range("F3").Value = Range("F3").Value + 1  
End Sub
more ▼

answered Jul 11 '12 at 04:13 PM

Bulldawg gravatar image

Bulldawg ♦♦
330 6 15 22

(comments are locked)
10|600 characters needed characters left

Right click on the sheet tab and go to 'View Code'. This will open the Microsoft Visual Basic editor. When it opens, on the left side double click on 'This Workbook'. That will open the macro code editor for the workbook. Then in the top two drop down menus, select Wookbook and Open. Then copy and paste the below. Then save and reopen the file. Each time you open the file it will automatically select sheet1 and add one to the value in cell B2.

Private Sub Workbook_Open()

Sheet("Sheet1").Select 'change Sheet1 here to the name of your sheet Cells(2, 2).Value = Cells(2, 2).Value + 1

End Sub

You can also check [anthem bcbs co][1].

[1]: http://2healthinsurance.net/health-insurance-companies/anthem-bcbs-colorado/
more ▼

answered Jul 16 '12 at 05:43 AM

njovianni gravatar image

11 1

(comments are locked)
10|600 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

(c) 2013 Orasi Software, Inc.