+ Reply to Thread
Results 1 to 8 of 8

Run-time error '13' on Loop + Speed up macro

  1. #1
    Registered User
    Join Date
    12-09-2008
    Location
    Canada
    Posts
    79

    Run-time error '13' on Loop + Speed up macro

    Can you guys tell me why I get a "Run-time error '13'?" on this line:
    "If Cell = "#N/A" Then"

    This is my code:
    Please Login or Register  to view this content.
    Much appreciate it!
    Last edited by GeorgY; 03-04-2009 at 03:17 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: Run-time error '13' on Loop

    Maybe this:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 03-04-2009 at 02:23 PM.
    _________________
    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
    12-09-2008
    Location
    Canada
    Posts
    79

    Re: Run-time error '13' on Loop

    Thanks, that worked.

    Now the problem is that I have about 45,000 rows. There are only 150-200 erros that would imply that about 150-200 rows would have to be copied. However, this seems to be taking forever, it copies about 1 line per minute.

    Any way to speed it up?

  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: Run-time error '13' on Loop + Speed up macro

    If you posted a sheet, or a small sample of it, could fiddle with your code directly and see. Else just making general untested suggestions.

    Perhaps not selecting cells will speed things up.
    Please Login or Register  to view this content.

  5. #5
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Run-time error '13' on Loop + Speed up macro

    Try turning off screen updating:
    At the beginning of your code, after you name your variables put:
    Please Login or Register  to view this content.
    And at the end, before end sub put:
    Please Login or Register  to view this content.
    Dave

  6. #6
    Registered User
    Join Date
    12-09-2008
    Location
    Canada
    Posts
    79

    Re: Run-time error '13' on Loop + Speed up macro

    Quote Originally Posted by JBeaucaire View Post
    If you posted a sheet, or a small sample of it, could fiddle with your code directly and see. Else just making general untested suggestions.

    Perhaps not selecting cells will speed things up.
    Please get the sheet from this URL, because I am having trouble attaching it via the forum:
    http://bplusbsolutions.com/Book1.zip

    It just takes it forever to run...almost as if it will never finish.

    I zipped the file because there is lots of data on the spreadsheets.
    Last edited by GeorgY; 03-05-2009 at 02:01 AM.

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

    Re: Run-time error '13' on Loop + Speed up macro

    Well, this code runs a little faster as it skips the "copy 45000 VLOOKUP formulas in place. But it still took over 10 minutes.
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 03-05-2009 at 01:48 PM.

  8. #8
    Registered User
    Join Date
    12-09-2008
    Location
    Canada
    Posts
    79

    Re: Run-time error '13' on Loop + Speed up macro

    Quote Originally Posted by JBeaucaire View Post
    Well, this code runs a little faster as it skips the "copy 45000 VLOOKUP formulas in place. But it still took over 10 minutes.
    Thanks. It really does take a long time, for me it took over 15 minutes..perhaps I have a slower computer. It will have to do for now anyways.

    If anyone can suggest a way to make this run quicker, please let me know.

+ 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