+ Reply to Thread
Results 1 to 5 of 5

Looping Next without For error

  1. #1
    Registered User
    Join Date
    06-10-2009
    Location
    Sandy Eggo
    MS-Off Ver
    Excel 2010
    Posts
    65

    Looping Next without For error

    I'm trying to figure out what I did to the looping in the below macro that caused me to get a "Compile error: Next without For" notificaiton.

    Please Login or Register  to view this content.
    Last edited by sdgenxr; 03-06-2017 at 04:23 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,036

    Re: Looping Next without For error

    Hi Sandy,

    I get this error if my "If" doesn't have an ending "End If". The compiler goes down looking for matching If->End If and they don't match. Then it doesn't know how to close a "For", looking for a "Next".

    See if that is an answer that fits your code. BTW - Where is your Sub and End Sub?
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    11,981

    Re: Looping Next without For error

    The problem starts at line #50:
    Please Login or Register  to view this content.
    Fixing your indentations will help you to keep track of If..End If blocks.
    Last edited by protonLeah; 03-05-2017 at 09:52 PM.
    Ben Van Johnson

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,840

    Re: Looping Next without For error

    Put this line
    Please Login or Register  to view this content.
    Before the line of next iteration
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  5. #5
    Registered User
    Join Date
    06-10-2009
    Location
    Sandy Eggo
    MS-Off Ver
    Excel 2010
    Posts
    65

    Re: Looping Next without For error

    Got it! Thanks everyone!

+ 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. On Error Looping Macro
    By locopete999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2016, 08:21 AM
  2. Unexpected error while looping
    By mohan.r1980 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-08-2015, 05:44 AM
  3. [SOLVED] Looping error
    By Aaron092 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-26-2014, 07:40 AM
  4. [SOLVED] Error trapping and looping
    By ANDREWA in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-04-2013, 12:26 PM
  5. [SOLVED] Error when Looping through two different ranges
    By Cjredmo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2012, 01:41 PM
  6. Looping Error
    By mcclanat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2011, 12:01 PM
  7. Error in Link Looping
    By barksmith in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-25-2009, 09:30 AM

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