Change number when you open the excel template

M

mowen

Hi everebody

My intention is to make a template to my reports. To make order in al
my reports I want a macro that change the reports number every time
open the template.
First time I open the template the reports number will be 1 (The strin
in the workbook is Report number 1) and next time report number 2.....

I hope it is possible and that one of you excel members will help m
out!

Thank you and best regards
Run
 
S

swatsp0p

try something like this in a Workbook Open() event:

Private Sub Workbook_Open()
Sheets("sheet1").Select
Range("A1").Value = Range("A1").Value + 1
Range("A1").Select

End Su
 
M

mowen

Hi again

I have discovered a problem when I saved the report with another name.
With this code it will also count everytime I open this file. It is
possible to restrict the macro to only be active at the template file
or other methods to avoid this problem?

best regards
Rune
 
Top