+ Reply to Thread
Results 1 to 3 of 3

Multiple If statements inside a for loop error

  1. #1
    Registered User
    Join Date
    11-05-2012
    Location
    New York, New York
    MS-Off Ver
    2011
    Posts
    8

    Multiple If statements inside a for loop error

    Hi - I am trying to run the following for statement for a long list of rows, checking to see if certain criteria are met, and if so, inserting a value into column "O". With the logic being that once a condition is met and a value is placed in column O, you exit the if statements and re-start the loop for the next line.

    The problem is that I have one argument (checking column C and D) with an if statement within an if statement (bolded and underlined below). When running through, if the value in column C passes the test but not column D, then it falls out of the if statements, going to End If, instead of testing the next If statement, for column E. Can anybody think of a way to manipulate this so that if column "C" passes the check but not "D" it goes onto the next If argument (checking for col E) instead of falling out of the loop.

    Please Login or Register  to view this content.
    Last edited by pvhs07; 10-11-2013 at 12:31 PM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Multiple If statements inside a for loop error

    Please use code tags with your code as per forum's rule.
    You have many if missing, so I am not sure which is correct. This is one option.

    Untested


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-05-2012
    Location
    New York, New York
    MS-Off Ver
    2011
    Posts
    8

    Re: Multiple If statements inside a for loop error

    This appears to be working. Thank you very much for the 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] Syntax for formula that uses multiple conditions inside of multiple IF statements
    By njmiller31 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-02-2013, 11:55 AM
  2. Nested For Loop + If Statements Error
    By cinarbe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-01-2012, 10:41 AM
  3. Replies: 1
    Last Post: 08-10-2012, 03:24 AM
  4. VBA For loop where number of iterations can be changed from inside loop
    By barrboy89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-11-2011, 12:18 PM
  5. 'Loop without do' error message (code inside)
    By Jeroen1000 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2009, 07:16 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