ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Template Constant Update (https://www.excelbanter.com/excel-programming/399134-template-constant-update.html)

AJ

Template Constant Update
 
Hello
I have a workbook which has sequential numbering as per the code below:
Private Sub workbook_Open()
worksheets("FORM").Range("K2") = worksheets("FORM").Range("K2") + 1
End Sub

My question is if I use this workbook as a template with data tracking, how
can I keep the sequential numbering to go on once I have saved it as xlt.

Thanks in advance for a reply/solution

AJ

Tom Ogilvy

Template Constant Update
 
You would need to store your seqential number somewhere outside the workbook,
such as in the registry.

The correct answer will depend on how you are going to use the template (is
it on a shared drive or only accessed from one computer? Will there each
number be unique amongst all users [a number is used once only] or unique to
each user [each user can use a number once] and so forth).

--
Regards,
Tom Ogilvy


"AJ" wrote:

Hello
I have a workbook which has sequential numbering as per the code below:
Private Sub workbook_Open()
worksheets("FORM").Range("K2") = worksheets("FORM").Range("K2") + 1
End Sub

My question is if I use this workbook as a template with data tracking, how
can I keep the sequential numbering to go on once I have saved it as xlt.

Thanks in advance for a reply/solution

AJ


AJ

Template Constant Update
 
The template is on a shared drive used by one computer. The number is Unique
among all users (if any).
Thanks for your reply and appreciate to see a solution.

"Tom Ogilvy" wrote:

You would need to store your seqential number somewhere outside the workbook,
such as in the registry.

The correct answer will depend on how you are going to use the template (is
it on a shared drive or only accessed from one computer? Will there each
number be unique amongst all users [a number is used once only] or unique to
each user [each user can use a number once] and so forth).

--
Regards,
Tom Ogilvy


"AJ" wrote:

Hello
I have a workbook which has sequential numbering as per the code below:
Private Sub workbook_Open()
worksheets("FORM").Range("K2") = worksheets("FORM").Range("K2") + 1
End Sub

My question is if I use this workbook as a template with data tracking, how
can I keep the sequential numbering to go on once I have saved it as xlt.

Thanks in advance for a reply/solution

AJ


Tom Ogilvy

Template Constant Update
 
You could have it read and write information to a text file at a specific
location on the shared drive. Or if it will only be used on one computer,
you can use the getsetting and savesetting commands to read and write a value
to the registry. these are very simple to use and explained well in the
Excel VBA help.

Just put code to use them in the workbook_open event of the template.

--
Regards,
Tom Ogilvy


"AJ" wrote:

The template is on a shared drive used by one computer. The number is Unique
among all users (if any).
Thanks for your reply and appreciate to see a solution.

"Tom Ogilvy" wrote:

You would need to store your seqential number somewhere outside the workbook,
such as in the registry.

The correct answer will depend on how you are going to use the template (is
it on a shared drive or only accessed from one computer? Will there each
number be unique amongst all users [a number is used once only] or unique to
each user [each user can use a number once] and so forth).

--
Regards,
Tom Ogilvy


"AJ" wrote:

Hello
I have a workbook which has sequential numbering as per the code below:
Private Sub workbook_Open()
worksheets("FORM").Range("K2") = worksheets("FORM").Range("K2") + 1
End Sub

My question is if I use this workbook as a template with data tracking, how
can I keep the sequential numbering to go on once I have saved it as xlt.

Thanks in advance for a reply/solution

AJ



All times are GMT +1. The time now is 09:17 PM.

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