+ Reply to Thread
Results 1 to 4 of 4

If And Or Statement Help

  1. #1
    Forum Contributor
    Join Date
    12-09-2015
    Location
    Virginia, USA
    MS-Off Ver
    2007
    Posts
    121

    If And Or Statement Help

    Can someone help me with the following. Basically, I need the start of an if statement that looks at Column A and if the line begins with "N" and the ensuing line starts with "Startlist" or there is a blank line to go into the routine. This works perfectly up until I am at the end of my data set and the routine runs because it sees a blank line (even though the last line of the data set does not begin with "N"). Is there a way to make the requirement of having "N" in Column A absolute, so if that is false it goes into my other routines?


    Please Login or Register  to view this content.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,443

    Re: If And Or Statement Help

    Hi,

    Does adding brackets so that the OR function is dealt with first help?

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: If And Or Statement Help

    I believe there are two options and others may be able to chime in and assist further..
    But one way would be to have your "N" condition its own and the others nested under that.. so that it has to be "N" before the others are even checked.

    then another would be to find the last row in your dataset instead of using rowindex, which i believe will loop the entire sheet.

    Not sure if this would be the correct format without a sample file, but just to give you an idea of what i meant by nested.
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    12-09-2015
    Location
    Virginia, USA
    MS-Off Ver
    2007
    Posts
    121

    Re: If And Or Statement Help

    Thank you both for your help. Adding the parenthesis did the trick!

+ 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] IF Statement with Multi-Criteria Statement inside a Data Validation List
    By dharvey1978 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-31-2020, 09:10 PM
  2. [SOLVED] If statement to select data - nested statement - assistance
    By petitesouris in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-29-2015, 09:55 PM
  3. compile error expected line number statement end statement
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-18-2014, 10:12 AM
  4. VBA Compile Error : line number or label or statement or end of statement
    By excellearner121 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2013, 06:41 PM
  5. Replies: 4
    Last Post: 06-01-2012, 10:05 AM
  6. Replies: 4
    Last Post: 05-16-2012, 05:33 PM
  7. [SOLVED] Utilize a Select Case Statement in Target Intersect Statement
    By max57 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-29-2009, 08:55 PM

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