Field whose value increments automatically
Is it possible to create a field which automatically increments by 1 every
time I open the worksheet? Thanks... |
Only with code. Use the Workbook_Open event procedure to
increment a value in a cell. For example, put the following code in the ThisWorkbook code module: Private Sub Workbook_Open() With ThisWorkbook.Worksheets("Sheet1").Range("A1") .Value = .Value + 1 End With End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Quinnboy" wrote in message ... Is it possible to create a field which automatically increments by 1 every time I open the worksheet? Thanks... |
Thanks very much - that's very helpful. Is there any way to do it with a
template rather than a normal workbook? This method works great if the file is saved each time, but when using a template to create a new workbook, using the SAVE command will save the new workbook and not make any changes to the template itself. Is there any way to automatically save a new version of the template? TIA "Chip Pearson" wrote: Only with code. Use the Workbook_Open event procedure to increment a value in a cell. For example, put the following code in the ThisWorkbook code module: Private Sub Workbook_Open() With ThisWorkbook.Worksheets("Sheet1").Range("A1") .Value = .Value + 1 End With End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Quinnboy" wrote in message ... Is it possible to create a field which automatically increments by 1 every time I open the worksheet? Thanks... |
All times are GMT +1. The time now is 06:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com