Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2001
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    limiting macros (Excel 2000)

    I have written a simple macro in the personal workbook so it can be used on all sheets that re active, the problem is that I want it to be only run ONCE per workbook. The macro is triggered via a custom button so it is accessible to all workbooks.

    What kind of code can I place in the macro that would ensure that the macro can only be run once for a particular workbook.

    Thanks

  2. #2
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Maidstone, Kent, England
    Posts
    398
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: limiting macros (Excel 2000)

    If you only want it to run for the work book once ever I would have it write a value to a hidden spot on the sheet and have it check for that value before running.

    HTH

    Peter

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: limiting macros (Excel 2000)

    If you want it to run once in the Excel session for each workbook then you can keep a list of workbooks you have already processed in a Static variable. This will only get cleared if you exit from Excel and restart it (or click the stop button in the Visual Basic environment).

    StuartR

Posting Permissions

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