Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Quinnboy
 
Posts: n/a
Default Field whose value increments automatically

Is it possible to create a field which automatically increments by 1 every
time I open the worksheet?

Thanks...
  #2   Report Post  
Chip Pearson
 
Posts: n/a
Default

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...



  #3   Report Post  
Quinnboy
 
Posts: n/a
Default

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...




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with Pivot Table Field Sorting in Excel 2002 Phoenix71555 Excel Discussion (Misc queries) 1 February 27th 05 11:25 PM
Pivot Tables..I give up... Debutante Excel Worksheet Functions 4 January 21st 05 10:43 PM
Automatically Populating Worksheet from Collected Input for Pricelist David Littrell via OfficeKB.com Excel Worksheet Functions 1 January 6th 05 05:04 PM
How to create a calculated field formula based on Pivot Table resu dha17 Excel Discussion (Misc queries) 1 December 15th 04 05:39 AM
How do link to a remote field but use the path from a stored field Michael T. Excel Discussion (Misc queries) 1 December 10th 04 12:18 AM


All times are GMT +1. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"