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.
Answer by Bulldawg · Jul 11, 2012 at 04:13 PM
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
Answer by njovianni · Jul 16, 2012 at 05:43 AM
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
You can also check anthem bcbs co.