Results 1 to 4 of 4

Thread: Keeping array values after macro run

  1. #1
    Board Regular
    Join Date
    Dec 2018
    Posts
    75
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Keeping array values after macro run

    Hey guys,

    I have a project that I'm making and it contains 3 arrays. Once i run the macro, all the actions are done, but the array is not erased, if i re-run the macro the values inside keep doubling(keeps old values and adds them again).
    I am using erase at the end of the last sub now to make sure that doesn't happen, but I was wondering where is it even being saved? I assumed once my subs finish running all memory is just cleared. Nor have i run into this issue before, while never erasing arrays.
    Why is this happening?

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,177
    Post Thanks / Like
    Mentioned
    470 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Keeping array values after macro run

    Sounds like you have declared the arrays outside of the procedure.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  3. #3
    Board Regular
    Join Date
    Dec 2018
    Posts
    75
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Keeping array values after macro run

    Quote Originally Posted by Fluff View Post
    Sounds like you have declared the arrays outside of the procedure.
    First time i tried declaring outside of scope, of course that's the issue, thanks again Fluff!!

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,177
    Post Thanks / Like
    Mentioned
    470 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Keeping array values after macro run

    You're welcome & thanks for the feedback
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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