+ Reply to Thread
Results 1 to 11 of 11

Runtime Error "Next Without For"

  1. #1
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Runtime Error "Next Without For"

    I get a "Next Without For" runtime error for this code. Can anyone help me find out what's wrong?

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: Runtime Error "Next Without For"

    The reason we write code with different line indentations is to make it easier to see at a glance what code is contained in, for example, an IF THEN statement, or a FOR NEXT loop, etc. Your code indentations don't even slightly match what's going on, which is why you're having trouble spotting what you've done.

    Firstly, re-indent your code (i'm sure that's not the right word but it's been a long day), then it'll be easy to spot the NEXT you've put behind an IF THEN that's not being recognised.

  3. #3
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: Runtime Error "Next Without For"

    Hi BellyGas,

    i could not understand. Please help me where i have to be changed in this code?

    Are you need the excel file? then i will attached

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Runtime Error "Next Without For"

    A few problems... at the end you have one too many "end if" but also, you have

    Please Login or Register  to view this content.
    inside the for i = 1 to lr loop, and the End If for that is outside the For i... loop.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Runtime Error "Next Without For"

    The best I can do is guess at the intended functionality and suggest trying this ammended code:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: Runtime Error "Next Without For"

    Hi Arkadi,

    i am using you code but getting the same error. I attached the excel file. please review and help me to resolve the issue
    Attached Files Attached Files

  7. #7
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,467

    Re: Runtime Error "Next Without For"

    Hi there,

    Try adding the highlighted line:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  8. #8
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: Runtime Error "Next Without For"

    i am not getting an error with this code. But this code is unable to fetch the data. Please check where i have done mistake
    Attached Files Attached Files

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Runtime Error "Next Without For"

    @Greg M Oops, I had missed that, nice catch.

  10. #10
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: Runtime Error "Next Without For"

    Any one please help me to find out where i have done a mistake in this code. Because, this code is unable to fetch the data based on selected date.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    07-15-2015
    Location
    Kolkata
    MS-Off Ver
    2010 & 2013
    Posts
    303

    Re: Runtime Error "Next Without For"

    Please help me on this. I can not understand how do i resolve the issue. Please help

+ 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. [SOLVED] RunTime Error 9 when using "With(strName)" to find sheet "strName"
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-30-2016, 09:38 PM
  2. Mac excel error Runtime Error 429 due to CreateObject("Scripting.Dictionary")
    By iamstevetay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2015, 04:21 PM
  3. runtime error 438 "object doesn't support this property or method"
    By lazyengineer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2015, 01:47 PM
  4. [SOLVED] Frequently Used Macro now Giving a" Runtime Error '1004 Application-Object Defined Error"
    By rjw524 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-02-2015, 02:39 PM
  5. Replies: 0
    Last Post: 07-24-2014, 08:59 PM
  6. Vlook up VBA Error when value not found "runtime error -1004"
    By sriram170 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-06-2013, 01:14 PM
  7. [SOLVED] Merged cells cause "Runtime error 13 type mismatch" problem
    By Ralph Malph in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2006, 08:55 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