Counter linked to Registry

N

Norm Taylor

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

Otto Moehrbach

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top