+ Reply to Thread
Results 1 to 4 of 4

Change number when you open the excel template

  1. #1
    Registered User
    Join Date
    04-19-2004
    Posts
    18

    Change number when you open the excel template

    Hi everebody

    My intention is to make a template to my reports. To make order in all my reports I want a macro that change the reports number every time I open the template.
    First time I open the template the reports number will be 1 (The string 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 me out!

    Thank you and best regards
    Rune

  2. #2
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    try something like this in a Workbook Open() event:
    [VBA]
    Private Sub Workbook_Open()
    Sheets("sheet1").Select
    Range("A1").Value = Range("A1").Value + 1
    Range("A1").Select

    End Sub[/VBA]
    Bruce
    The older I get, the better I used to be.
    USA

  3. #3
    Registered User
    Join Date
    04-19-2004
    Posts
    18
    Hi swatsp0p

    Thanks mate!

  4. #4
    Registered User
    Join Date
    04-19-2004
    Posts
    18
    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1