ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Counter linked to Registry (https://www.excelbanter.com/excel-programming/282709-counter-linked-registry.html)

Norm Taylor

Counter linked to Registry
 
I want to add VB subroutine code, when I open an Excel
template form that I have built that a defined cell
receives a unique number by counting one greater than
when the form was previously opened from the VB code.


Otto Moehrbach[_5_]

Counter linked to Registry
 
Norm
Paste this macro in the Workbook module. You access this module by
right-clicking on the icon to the left of the "File" of the worksheet menu
and selecting View Code. X-out of the VBE to return to the worksheet. As
written, this macro increments A1 by 1 each time the file is opened. HTH
Otto
Private Sub Workbook_Open()
Sheets("MySheet").Range("A1") = _
Sheets("MySheet").Range("A1") + 1
End Sub
"Norm Taylor" wrote in message
...
I want to add VB subroutine code, when I open an Excel
template form that I have built that a defined cell
receives a unique number by counting one greater than
when the form was previously opened from the VB code.





All times are GMT +1. The time now is 11:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com