+ Reply to Thread
Results 1 to 5 of 5

Memory problem from macro creating and naming sheets from Array?

  1. #1
    Registered User
    Join Date
    08-23-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    13

    Memory problem from macro creating and naming sheets from Array?

    In the attached Workbook I have a macro that copies a master sheet and then renames it according to a range in the 'Ctrl' sheet. Unfortunately before all the sheets can be created the memory fills up and the macro breaks.

    If someone could tell me how to clear the memory after each sheet has been created it would be much appreciated! Also if possible it would be great to add some lines that check if the number of names in the list is longer than the existing no. of sheets, if so continue, if not exit.

    Any help much appreciated.

    Best

    Alex

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Memory problem from macro creating and naming sheets from Array?

    What is the error message you get?
    What line of code is highlighted when you DEBUG at the macro error?
    Where is the sample workbook? (Zip it up if necessary, or trim it down.)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-23-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Memory problem from macro creating and naming sheets from Array?

    Sorry, the attachment has failed twice now...here is the code:

    Please Login or Register  to view this content.
    The error message is:
    Run-Time error 1004

    Then points to:
    Please Login or Register  to view this content.
    Thanks for the help
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Memory problem from macro creating and naming sheets from Array?

    1) The uploaded wb has no sheet named Master and no sheet named FX. Both of those truths result in the error you've seen.

    2) The uploaded wb has no reference data to create arrays from

    3) The beginning of the macro does not include instructions to the array commands on which worksheet to create those arrays from

    4) The uploaded wb does not include the macro you've referenced.

  5. #5
    Registered User
    Join Date
    08-23-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Memory problem from macro creating and naming sheets from Array?

    Sorry:
    I had to strip out the private information i.e loosing the ranges etc, I don't know why the workbook doesn't contain the macro as it does for me. The sheet names was an error...

    I have got the macro working by using a template instead of copying a sheet. Using the code below:

    Please Login or Register  to view this content.
    This is fine, but Ideally i'd like to keep it in the workbook as this is a model that will be used by people that a) Don't have any knowledge of VBA and won't know how to point to the Template location...

    I've attached a workbook that I just tested and works, it won't let me attach the template so insert a excel template file with one sheet named 'Master'...You will need to point to it's location in the code in 'Location of template'
    Sorry for failing to do this before.

    I think I want to copy a sheet in the sheet and then clear the clipboard after every iteration, whats your thoughts on this?
    Regards
    Alex
    Attached Files Attached Files
    Last edited by acj06; 10-27-2011 at 02:26 PM. Reason: Can't Spell

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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