+ Reply to Thread
Results 1 to 8 of 8

HELP - This Macro works on small amounts of data but fails on large amounts

  1. #1
    Registered User
    Join Date
    06-17-2015
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    4

    Question HELP - This Macro works on small amounts of data but fails on large amounts

    Hello everyone,

    I have a macro that works fine on a sheet containing 3,000 rows yet on another that contains 20,000 rows it fails.

    Can someone advise a way to enhance this macro or why it fails?

    The macro has to search sheet1 for a specific name in a field (E.g. John) and then copy that row into sheet2 then return to sheet1 and find the next occurrence of the name "John". It then again copies that row and then return to sheet2 and adds that row on the row below the last.

    Simply put the purpose is to extract all rows from columnA that contain "John" and paste them into sheet2.

    Here is the macro I have been using:




    Please Login or Register  to view this content.


    ------------------------

    Many thanks for any help or answers.

    Thanks for the tips too!
    Last edited by BookmanNLA; 06-18-2015 at 12:41 AM.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: HELP - This Macro works on small amounts of data but fails on large amounts

    Saying something fails is not helpful, neither are terms like doesn't work or crashes.
    Please be specific, do you get an error? If so, what is the error, what are the values of your variables when you get the error, etc. etc. etc.

    One possibility but if it's only 20,000 or so rows is your integer variable types. Change them to long, if that doesn't fix it you need to go into detail.


    Also to conform with the board rules wrap your code in code tags.
    Highlight all the code click on the # icon and save changes.

    Thanks.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: HELP - This Macro works on small amounts of data but fails on large amounts

    Please Login or Register  to view this content.
    Please read #3 in the Forum Rules.
    Last edited by jolivanes; 06-17-2015 at 11:31 PM.

  4. #4
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: HELP - This Macro works on small amounts of data but fails on large amounts

    Hi..

    Try this one too...

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by apo; 06-17-2015 at 11:25 PM.

  5. #5
    Registered User
    Join Date
    06-17-2015
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    4

    Re: HELP - This Macro works on small amounts of data but fails on large amounts

    Added # - thanks for the tips.

    What do you mean by "integer variable types to long"?

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: HELP - This Macro works on small amounts of data but fails on large amounts

    Here is one explanation on using variables

    https://support.microsoft.com/en-us/kb/843144

  7. #7
    Registered User
    Join Date
    06-17-2015
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    4

    Re: HELP - This Macro works on small amounts of data but fails on large amounts

    Thanks for the tip - I will go have a read after I test your code.

    Also I tried Apo's solution and it worked fine on the small scale yet on the large I received this error:

    Run-time error '1004':
    Application-defined or object-defined error
    It showed the bold line as the cause:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-17-2015
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    4

    Re: HELP - This Macro works on small amounts of data but fails on large amounts

    Problem solved - Big thanks to jolivanes and Apo.

    Time for me to go and read about variables at - https://support.microsoft.com/en-us/kb/843144

    Thank you again!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to copy and past large amounts of data
    By ulikel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-05-2015, 06:51 PM
  2. Large amounts of data
    By namluke in forum Excel General
    Replies: 3
    Last Post: 12-11-2014, 02:40 PM
  3. [SOLVED] Rearranging large amounts of data
    By kozor in forum Excel General
    Replies: 6
    Last Post: 10-30-2012, 05:41 AM
  4. transposing large amounts of data
    By Trailrunner47 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2011, 12:44 PM
  5. Large Amounts of Data
    By Drewser33 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 06-17-2008, 09:13 AM

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