+ Reply to Thread
Results 1 to 15 of 15

Macro Adjustment Needed To Stop Freeze

  1. #1
    Forum Contributor
    Join Date
    07-07-2008
    Location
    sCOTLAND
    MS-Off Ver
    Office 2003 SP3
    Posts
    256

    Macro Adjustment Needed To Stop Freeze

    Hi

    I have this macro, kindly donated by excelxx, it was working good when i tested it on a couple of hundred rowns of data. I have now dropped the live data into the workbook list.xls and it just seems to be stopping now.

    The live list.xls is about 30.000 rows. It looks in colums A & B, i am not sure if this is the cause but i have some 0s and blanks in them columns. It maybe there is just to much data.

    Could someone please have a look and maybe suggest where its going wrong. I have highlighted (CODE STOPS HERE) where the code seems to stop

    Thanks



    Please Login or Register  to view this content.
    Last edited by JimmiOO; 03-09-2010 at 01:37 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Macro Adjustment Needed

    Hello JimmiOO,

    You need to better define "code stops here". Does the macro generate an error? If so what is the error number? Does the macro keep looping? Does Excel just freeze?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro Adjustment Needed

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Contributor
    Join Date
    07-07-2008
    Location
    sCOTLAND
    MS-Off Ver
    Office 2003 SP3
    Posts
    256

    Re: Macro Adjustment Needed To Stop Freeze

    Hi Leith I do not get an error and it looks like the macro is still running but it just seems to keep looping then freezes up, when i press the esc button the macro is stopped on the part i have highlighted. Sorry RoyUK i have changed the title i hope this is better.

  5. #5
    Forum Contributor
    Join Date
    07-07-2008
    Location
    sCOTLAND
    MS-Off Ver
    Office 2003 SP3
    Posts
    256

    Re: Macro Adjustment Needed To Stop Freeze

    Is there anything i could possible put in this code that would resume on errors? I have had it running all night and still the same, it seems to be stopping in the same place.

  6. #6
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Macro Adjustment Needed To Stop Freeze

    Hi JimmiOO

    I'm not sure what is going wrong here, but please let me know how many entries are in the following files

    List
    Supplier
    Summary

    I think we may have to switch off the screenupdating so that we can see what's going on.

  7. #7
    Forum Contributor
    Join Date
    07-07-2008
    Location
    sCOTLAND
    MS-Off Ver
    Office 2003 SP3
    Posts
    256

    Re: Macro Adjustment Needed To Stop Freeze

    Hi excelxx

    In the List there is about 15000
    Supplier there is 179
    and Summary there is about 2000

    I think it is the amount of data, when i cut the list down to 1000 it takes a while but does work,

  8. #8
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Macro Adjustment Needed To Stop Freeze

    Hi JimmiOO

    The way I had written the code before seems like it was ok for small amounts of data but not so efficient for large amounts of data. (The disadvantage of being self taught).

    If have revised the code so for the amount of data you mentioned it runs in good time.

    Please Login or Register  to view this content.
    Please let me know how you get on.

  9. #9
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Macro Adjustment Needed To Stop Freeze

    hi Jimmi00,

    I'm having a go at changing the code from your original post so that it will process arrays "in memory" which should help to speed up even when compared against Excelxx's revised version.

    To help me grasp exactly what is needed, can you please explain the intent of the loops in "plain English"?

    Excelxx, don't let being self taught become a limitation - I am self taught too & it lets me choose the best way from all the offerings that can be found on the web - without getting wrapped up in one teacher's belief that their way is the best way

    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Macro Adjustment Needed To Stop Freeze

    Quote Originally Posted by broro183 View Post
    I am self taught too & it lets me choose the best way from all the offerings that can be found on the web - without getting wrapped up in one teacher's belief that their way is the best way
    Same for me too.
    Everyone who confuses correlation and causation ends up dead.

  11. #11
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Macro Adjustment Needed To Stop Freeze

    hi all,

    Blimey!
    Excelxx, you & I are in good company
    It's good to see you pop by RS, you might be able to straighten out my below "theoretical" code (untested), even before we get a sample to test it on...

    Jimmi00,
    I've put some possible code in the attached file*, but it needs to be tested for validity (eg how will it respond to empty cells - perhaps we need to include Cstr as a wrapper etcetc) & functionality (eg the size of the arrays may cause it to not write back to the sheet correctly or even just roll over & curl up its toes!) - I'm not sure without testing it.
    Can you please zip (I'm on a slow connection) & upload a sample file (maybe with 100 rows of dummy data) for each of the Master, List, Sum & Supp files?
    Also, on rereading Excelxx's revision, you may find that his/her use of ".Find" is sufficient for speeding up the code. Anyway, in case you want to have a go at the testing yourself, please see attached file for my untested version with the original code commented out alongside it...
    *(I've attached it as a file because, with the comments in the code, it made my post too long to upload.)

    RomperStomper,
    If you don't mind opening a file, do you have any thoughts on how likely it is that my approach will work?
    Could I be trying to hold too much "in memory"?
    How would you size the "wsMaster..." arrays?
    Is my use of Erase worthwhile/am I using it correctly?

    Thanks
    Rob
    Attached Files Attached Files

  12. #12
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Macro Adjustment Needed To Stop Freeze

    Rob,
    Without testing, I suspect that the nested loops will seriously hamper performance. I'm also not sure why you are using so many arrays for each range rather than one for each?

  13. #13
    Forum Contributor
    Join Date
    07-07-2008
    Location
    sCOTLAND
    MS-Off Ver
    Office 2003 SP3
    Posts
    256

    Re: Macro Adjustment Needed To Stop Freeze

    Thanks for all the help guys

    excelxx as always you have came up with something that does exactly what i need for this project, thank you so much again.

    Rob and Romperstomper thanks very much for the input, it is greatly appreciated, I am just about to post something else that yous may be able to help with. Basically it will be the same sort of thing as this project with a few differences.

    Thanks again, Problem Solved.

  14. #14
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Macro Adjustment Needed To Stop Freeze

    Thanks Romperstomper,

    Yes, I thought the same for the loops, but I was feeling too lazy to wrap my head around the code so I could unravel them properly. I thought I'd wait until the OP explains in plain English & then I may be able to make more informed comments - perhaps, even to move right away from a macro approach & replace it with formulae...

    Wow, this is my learning for the day :-)
    Before your question, I was completely ignorant that arrays with more than "1 dimension" could be written back to a worksheet!

    I've had a go at modifying my suggested code & will now wait for the OP to provide some example files for testing.

    Thanks
    Rob
    Attached Files Attached Files

  15. #15
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Macro Adjustment Needed To Stop Freeze

    Ohhh, I see once the page refreshed after posting that I'm too slow!

    Oh well, just out of curiosity, how long does excelxx's version take to run?

    Feel free to pm me a link to your new thread.

    Rob

+ 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