Results 1 to 48 of 48

Big List Sort. Not Enough Memory. Help Run my Code. Or help fix or change code Please :)

Threaded View

Doc.AElstein Big List Sort. Not Enough... 09-15-2016, 01:18 PM
Winon Re: Big List Sort. Not Enough... 09-15-2016, 01:39 PM
Doc.AElstein Re: Big List Sort. Not Enough... 09-15-2016, 02:26 PM
Winon Re: Big List Sort. Not Enough... 09-15-2016, 02:51 PM
Doc.AElstein Re: Big List Sort. Not Enough... 09-15-2016, 03:02 PM
Winon Re: Big List Sort. Not Enough... 09-15-2016, 03:33 PM
Doc.AElstein Re: Big List Sort. Not Enough... 09-15-2016, 03:52 PM
Winon Re: Big List Sort. Not Enough... 09-15-2016, 04:27 PM
Doc.AElstein Re: Big List Sort. Not Enough... 09-15-2016, 07:05 PM
NoSparks Re: Big List Sort. Not Enough... 09-15-2016, 09:12 PM
Doc.AElstein Re: Big List Sort. Not Enough... 09-16-2016, 04:32 AM
humdingaling Re: Big List Sort. Not Enough... 09-15-2016, 10:34 PM
humdingaling Re: Big List Sort. Not Enough... 09-15-2016, 10:47 PM
xlnitwit Re: Big List Sort. Not Enough... 09-16-2016, 04:01 AM
humdingaling Re: Big List Sort. Not Enough... 09-16-2016, 07:54 AM
Winon Re: Big List Sort. Not Enough... 09-16-2016, 07:25 AM
Doc.AElstein Memories... of Runing out of... 09-16-2016, 08:05 PM
Doc.AElstein Day 2: Waiting for my last... 09-19-2016, 07:57 PM
Doc.AElstein I would toggle your code, if... 09-20-2016, 02:29 PM
Doc.AElstein Thrashing VBA Memory Leaks.... 10-05-2016, 08:59 AM
Doc.AElstein Thrashing VBA Memory Leaks.... 10-05-2016, 09:00 AM
xlnitwit Re: Big List Sort. Not Enough... 09-16-2016, 08:03 AM
Doc.AElstein Cache Browser Data ... 09-16-2016, 10:18 AM
humdingaling Re: Big List Sort. Not Enough... 09-16-2016, 11:04 AM
Doc.AElstein Looks like Excel is the... 09-16-2016, 11:33 AM
xlnitwit Re: Big List Sort. Not Enough... 09-16-2016, 11:56 AM
Doc.AElstein Got Big list from xlNitWit... 09-16-2016, 12:14 PM
xlnitwit Re: Big List Sort. Not Enough... 09-16-2016, 12:49 PM
Doc.AElstein Re: Big List Sort. Not Enough... 09-16-2016, 01:11 PM
Winon Re: Big List Sort. Not Enough... 09-16-2016, 08:53 PM
Doc.AElstein Delete, Close Doesn't "Clear"... 09-17-2016, 05:48 AM
Winon Re: Big List Sort. Not Enough... 09-17-2016, 11:04 AM
Doc.AElstein Re: Big List Sort. Not Enough... 09-17-2016, 11:36 AM
Doc.AElstein Re: Check Difference between... 09-18-2016, 08:26 AM
Doc.AElstein So two closed workbook code... 09-18-2016, 08:42 AM
xlnitwit Re: Big List Sort. Not Enough... 09-19-2016, 08:52 AM
Doc.AElstein Re: Big List Sort. Not Enough... 09-19-2016, 09:22 AM
xlnitwit Re: Big List Sort. Not Enough... 09-20-2016, 01:49 AM
Doc.AElstein Re: Big List Sort. Not Enough... 09-20-2016, 04:58 AM
xlnitwit Re: Big List Sort. Not Enough... 09-20-2016, 06:32 AM
Doc.AElstein Bugger... Another Theory of... 09-20-2016, 07:36 PM
Doc.AElstein Getting there :) ..... slowly... 09-22-2016, 09:53 AM
xlnitwit Re: Getting there :) ........ 09-22-2016, 11:28 AM
Doc.AElstein Re: Getting there :) -- Next... 09-23-2016, 05:00 PM
Doc.AElstein Bugger me, a major... 09-25-2016, 08:21 PM
Doc.AElstein VBA is a weird Bugger when it... 09-26-2016, 06:12 PM
Doc.AElstein Trash the Big Excel File (... 09-27-2016, 08:23 PM
Doc.AElstein Re: Big List Sort. Not Enough... 06-08-2017, 06:56 AM
  1. #38
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    VBA is a weird Bugger when it Sets Ranges. It like Offsets. It holds ‘em differently

    VBA is a weird Bugger when it Sets Ranges. It like Offsets. It holds ‘em differently

    Just a quick update / recap before I move on or lose what is left of my sanity...

    Codes looping a Line pseudo like
    = .Match( , SecondArgumentRangeObject , )
    or
    = .Match( , rnglongSrcRow_x , )
    Where x can vary for a different “Long Row” Range Object.

    Codes where SecondArgumentRangeObject changed in each Loop by different Offset to a specific Range
    Sub USDAToDBArraysThirdWB18RngOffsets()
    Set rnglongSrcRow1 = wsDBlx.UsedRange.Range(wsDBlx.UsedRange.Cells(1, 11), wsDBlx.UsedRange.Cells(1, lcDBlx))
    Set rnglongSrcRow = rnglongSrcRow1.Offset(rDBlxHed, 0)
    64 Bit Win 7 Xl 2007 32 Bit -------Bombed out 348 rows at 24 Seconds

    Sub USDAToDBArraysThirdWB18RngOffsets()
    Set rnglongSrcRow1 = wsDBlx.Range(wsDBlx.Cells(1, 11), wsDBlx.Cells(1, lcDBlx))
    rnglongSrcRow = rnglongSrcRow1.Offset(rDBlxHed, 0)
    64 Bit Win 7 Xl 2007 32 Bit -------Bombed out 343 rows at 25 Seconds
    _.....................

    Codes where .Match code line is repeated so that each one uses a fixed Range Object
    Sub USDAToDBArraysThirdWB18RngObjects()
    Set rnglongSrcRow4 = wsDBlx.UsedRange.Range(wsDBlx.UsedRange.Cells(4, 11), wsDBlx.UsedRange.Cells(4, lcDBlx))
    x 18 etc ( just “row” 4 given here )
    64 Bit Win 7 Xl 2007 32 Bit -------Bombed out 336 rows at 23 Seconds


    Sub USDAToDBArraysThirdWB18RngObjects()
    Set rnglongSrcRow4 = wsDBlx.Range(wsDBlx.Cells(4, 11), wsDBlx.Cells(4, lcDBlx))
    x 18 etc ( just “row” 4 given here )
    64 Bit Win 7 Xl 2007 32 Bit -------Bombed out 344 rows at 23 Seconds

    Some slight variations on the couple above
    Sub USDAToDBArraysThirdWB18RngObjects2()
    Set rnglongSrcRow4 = wsDBlx.Range(wsDBlx.Cells(4, 11), wsDBlx.Cells(4, lcDBlx))
    With the entire 18 Set Long Row Ranges within the Loop
    64 Bit Win 7 Xl 2007 32 Bit -------Bombed out 341 rows at 25 Seconds

    Sub USDAToDBArraysThirdWB18RngObjectsFrmOfst()
    ( The range Objects are made ( Set ) from Offset from first Long Range Row Object )
    64 Bit Win 7 Xl 2007 32 Bit -------Bombed out 348 rows at 24 Seconds

    Back to the original Codes for a check:
    Sub USDAToDBArraysThirdWB()
    Here a code line like
    Set rnglongSrcRow = wsDBlx.Range(wsDBlx.Cells(rDBlxHed, 11), wsDBlx.Cells(rDBlxHed, lcDBlx))
    Sets the range each time. The same Long type variable, rDBlxHed, used in previous codes is used to specifically reference the Range of interest each time in the Loop
    64 Bit Win 7 Xl 2007 32 Bit -------Bombed out 344 rows at 21.... .. Minutes !!

    Sub USDAToDBSpreadsheetThirdBook()
    This is a simple "spreadsheet interaction code, - as a matched heading is found, the Nutrition value is pasted directly to the Output Workbook ( DBSept2016.xlsx ) - so no building of Array of multiple values to Paste out in one go
    64 Bit Win 7 Xl 2007 32 Bit -------Bombed out 368 rows at 25...... seconds!.. This is a bit wiered.. the code is basically the same as the one that takes 21 minutes ??
    Because of this last bit, I added a line to paste out arbritrarily to Workbook DBSept2016.xlsx in the code Sub USDAToDBArraysThirdWB(). So this effectively theoretically does away with the advantages of doing it in Arrays then pasting out in one go..
    _... the results were then
    64 Bit Win 7 Xl 2007 32 Bit -------Bombed out 342 rows at 25 Seconds. Another mad result!!

    _.. Just putting all that in words

    If I have a code line, pseudo

    = .Match( , SecondArgumentRangeObject , )
    and I have it in a Loop.

    It takes in my codes
    _1 ) Minutes if
    SecondArgumentRangeObject
    is Set at each loop to a different Range Object ( specifically like Set = Range(“___”) )

    _2 ) seconds if

    _either
    SecondArgumentRangeObject
    Is always the same Range Object
    _ or ( and this is the amazing thing )
    SecondArgumentRangeObject
    is Set at each loop to a different Range Object via some offset to a fixed Range.

    One could say, VBA does not like to change the Range Object that is used in a = .Match( , SecondArgumentRangeObject , ), unless that changed Object is changed via an Offset to a single Fixed Range Object ( But if you interact with the Worksheet it settles down !!! )

    In other words if I have _...

    rngX = Range(“A2”)

    and

    rngY = Range(“A1”).Offset(1, 0)

    _.... they both refer to Cell A2

    But Excel VBA handles them differently

    As long as all my different ranges are Set as an Offset ( that Offset can vary each time ) to any Range, then my code will run about
    60 times quicker than if I Set each range to the specific Range I want.

    That is weird!!! ( and The last bit, is either weird , or an amazing discovery !! )*** And to take the Insanity one stage further- Do the Orange Bit, then put Sub USDAToDBArraysThirdWB() back as it was, save, close, open the file.. run Sub USDAToDBArraysThirdWB(), and it is no longer slow !! AARRRGGGHHHH . ..and the orange phenomena does not always work.... I am losing the will to live : (
    Last edited by Doc.AElstein; 09-27-2016 at 07:58 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code For A Custom Sort Using A List On Another Sheet
    By rockyw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-06-2016, 08:51 PM
  2. [SOLVED] VB Code to sort the list
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-18-2016, 08:34 PM
  3. Help rewriting code to use less memory
    By Karl Gustaf Karsten in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-23-2016, 12:56 PM
  4. just a smidgeon of correction to VBA sort list code please
    By yogup in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-05-2016, 01:48 PM
  5. VB Code to sort the list in ascending order
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2015, 12:08 PM
  6. Add Custom Sort List to VBA code
    By Zyphon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-12-2009, 09:44 AM
  7. How much memory does VBA code occupy?
    By Ozgur Pars in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2006, 02:09 PM

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