+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : For without next error. If I add end ifs (or similar) I get Endif without Block if.

  1. #1
    Registered User
    Join Date
    08-08-2011
    Location
    New York, New York
    MS-Off Ver
    Excel 2007
    Posts
    10

    Unhappy For without next error. If I add end ifs (or similar) I get Endif without Block if.

    There is a problem, and I looked online to try to solve it. Unfortunately, it did not help, because the solution seemed to be to add end ifs, end selects, etc. When I add any, though, I get the problem mention in title. Can anyone help me with this problem? And what is the End if without block if problem?
    Please Login or Register  to view this content.
    The problem code shown above. End sub appears to be the problem, I wonder why?

    P.S. I am rather new, please forgive me for mistakes.
    Last edited by F1lm1; 08-08-2011 at 01:48 PM. Reason: Makes problem statement more clear

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: For without next error. If I add end ifs (or similar) I get Endif without Block i

    You've got two for loops, but only one Next ... that could be the place to start.

    PS. As a general rule you should indent your code so that each block instruction (With, If, Do, While, For, etc) has the code after it indented until it reaches its end condition. That makes it much easier to spot when you fail to terminate something properly.
    Last edited by Andrew-R; 08-08-2011 at 03:59 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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