+ Reply to Thread
Results 1 to 8 of 8

Excel Macro for parsing freezers or takes an incredible amount of time to run

  1. #1
    Registered User
    Join Date
    07-13-2012
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Excel Macro for parsing freezers or takes an incredible amount of time to run

    I will be the first to admit i am not well versed in VBA and so this code is a kind of Frankenstein build which is not a good idea... It appears to work, it just freezes excel for about 9 minutes.. should it really take that long? or am i doing something wrong thats causing a lot of unnecessary run-time? any thoughts would be welcome.

    BTW the goal of the code is to look at column A in a worksheet and break it down so that each distinct value in column A creates its own worksheet which then receives the Titles in Row 1 and any other rows for that distinct value.

    Thanks in advance

    Please Login or Register  to view this content.
    (source)
    Last edited by JBeaucaire; 07-13-2012 at 08:00 PM.

  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: Excel Macro for parsing freezers or takes an incredible amount of time to run

    I'm not sure what Frankensteining you're referring to, it appears the code is as originally published with a few lines commented out (and the authorship removed).

    Anyway, you're not the first person to mention their Excel does this. When I run this on mine and my test sheets, it's very fast, but occasionally people's workbooks appear to "lag" on the creation of the sheets. I'm going to ping some others to try it out.

    Can you post your workbook so we can see the problem in action? Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook. Thanks.
    _________________
    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
    07-13-2012
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Excel Macro for parsing freezers or takes an incredible amount of time to run

    Sorry by frakenstiening i meant i have no idea of how to actually right the complete code so i stole a body from yours and then took out things that seemed to be unnecessary for doing what i was doing/impeded the progress. Sorry if you did not appreciate me taking out the authorship.

    This is the work book i am attempting to run it on. Thank your for the quick response.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Excel Macro for parsing freezers or takes an incredible amount of time to run

    Try the attached.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Excel Macro for parsing freezers or takes an incredible amount of time to run

    Hi @jindon,

    Very nice code. Couple of quick questions:

    1) Would "dic(e) = Empty" would be the same as "dic.item(e) = Null". In other words add the key if it is not present.
    2) I have never seen the approach of using
    Please Login or Register  to view this content.
    as I have always assumed you have to loop through the keys. In essence is this the same?

    Thanks.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Excel Macro for parsing freezers or takes an incredible amount of time to run

    1) Yes
    dic(e) = Empty
    is equivalent to
    dic.Add key:= e, item:= Empty
    simply
    dic.Add e, Empty

    2) Yes it is the same as dic.Keys when property is omitted.

  7. #7
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Excel Macro for parsing freezers or takes an incredible amount of time to run

    Thanks. Always like to find ways to streamline the code.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Excel Macro for parsing freezers or takes an incredible amount of time to run

    I would regard elision of default properties as more obfuscation than streamlining.
    Entia non sunt multiplicanda sine necessitate

+ 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