Loop fails on 8th cycle with Invalid Forward Reference, or reference to uncompiled type

I am clearing data from the same range on series of named sheets (SaveL-25 to SaveL5).  This worked fine until a couple of days ago.  

Now I get a Runtime Error, but only after 7 iterations have happened.   

Does anyone have any ideas please? 

 

========

    Dim SaveLs As Integer

    Application.Calculation = xlCalculationManual

    Application.Iteration = False

 

For SaveLs = -25 To 5

   Sheets(“SaveL” & SaveLs).Range(“A22:AP5000”).ClearContents

Next SaveLs

==========       This fails when SaveLs = -18

 

I also tried changing the start to -17

For SaveLs = -17 To 5

   Sheets(“SaveL” & SaveLs).Range(“A22:AP5000”).ClearContents

Next SaveLs

 

==========       This runs longer but gives the same error when SaveLs = 5

 

I am running Excel 2016 64 bit.  The macro was originallycreated in Excel 2010 32 bit and I have recompiled it since then – which ran clean.

 

By: Ralph Magro

2,434 thoughts on “Loop fails on 8th cycle with Invalid Forward Reference, or reference to uncompiled type

  1. udfauzi.com

    That is a very good tip particularly to those new to the blogosphere. Brief but very accurate info… Many thanks for sharing this one. A must read post!

  2. cheap practice butterfly knife

    Hello, i read your blog occasionally and i own a similar one
    and i was just wondering if you get a lot of spam comments?
    If so how do you protect against it, any plugin or anything
    you can recommend? I get so much lately it’s driving me mad so any assistance is very much
    appreciated.

  3. iamgutsclub

    This is a good tip especially to those new to the blogosphere. Short but very precise information… Many thanks for sharing this one. A must read article!

  4. tokoonline88.com

    I was pretty pleased to find this website. I wanted to thank you for ones time for this particularly fantastic read!! I definitely appreciated every part of it and i also have you bookmarked to look at new things on your web site.

  5. genolyze

    Howdy! I simply wish to give you a huge thumbs up for the excellent information you have right here on this post. I’ll be returning to your site for more soon.

  6. HP driver

    I would like to thank you for the efforts you have put in writing this site. I’m hoping to view the same high-grade blog posts by you in the future as well. In truth, your creative writing abilities has inspired me to get my very own blog now 😉

  7. udfauzi.com

    You are so interesting! I do not think I have read through something like this before. So nice to find someone with genuine thoughts on this subject matter. Really.. thank you for starting this up. This web site is something that is required on the web, someone with a little originality!

  8. agen vivoslot

    May I simply say what a relief to discover someone who really understands what they are discussing on the net. You certainly understand how to bring a problem to light and make it important. A lot more people really need to read this and understand this side of the story. I was surprised you aren’t more popular given that you definitely possess the gift.

  9. visit website

    Im no pro, but I suppose you just made an excellent point. You naturally understand what youre talking about, and I can truly get behind that. Thanks for being so upfront and so honest.

  10. w88

    Thanks for sharing your thoughts. I truly appreciate your efforts and I am
    waiting for your further post thanks once again.

  11. togel online

    Hi, I do believe this is an excellent web site. I stumbledupon it 😉 I am going to come back yet again since i have bookmarked it. Money and freedom is the greatest way to change, may you be rich and continue to guide others.

  12. dingdong 24d

    Good day! I simply want to give you a huge thumbs up for your excellent info you have here on this post. I’ll be returning to your website for more soon.

  13. Kevin David Info

    Oh my goodness! an incredible article dude. Thanks Nonetheless I’m experiencing concern with ur rss . Don’t know why Unable to subscribe to it. Is there anyone getting similar rss problem? Anyone who knows kindly respond. Thnkx

  14. bandar qq

    You have made some really good points there. I looked on the web for additional information about the issue and found most people will go along with your views on this web site.

  15. togel hk

    An interesting discussion is definitely worth comment. I do believe that you ought to publish more about this subject, it might not be a taboo matter but usually people don’t speak about these issues. To the next! All the best!!

  16. qq online

    A fascinating discussion is definitely worth comment. I think that you should write more on this issue, it might not be a taboo subject but typically people don’t speak about such topics. To the next! Many thanks!!

  17. agen judi online resmi

    I was pretty pleased to find this site. I wanted to thank you for ones time for this fantastic read!! I definitely appreciated every bit of it and i also have you book-marked to see new things on your website.

Comments are closed.