+ Reply to Thread
Results 1 to 8 of 8

if statement not producing value expected

  1. #1
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    640

    if statement not producing value expected

    I have changed my code to exclude an anomaly I have in my code, I have added this line and although I know data meets this condition it is not finding any true conditions. I can't see anything wrong with it though, is there something I am missing??????

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: if statement not producing value expected

    What does row1 and row represent? Can you provide more of the code?

  3. #3
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    640

    Re: if statement not producing value expected

    I am remotely logged into the office computer and it will not allow me to copy paste outside sisco.

    row1 and row are two sets of values I am trying to match, a list and raw data (i.e. row1=1 & row=1) then it matches the following condition and this is the part I have changed and it has stopped working since I have changed it

  4. #4
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    640

    Re: if statement not producing value expected

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Sc0tt1e; 04-21-2015 at 11:32 AM.

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,985

    Re: if statement not producing value expected

    Hard to say without the data, but it there are two likely causes. One is that you haven't specified which worksheet you are referring to and the code may not be using the one you think (it will default to either the active sheet, or the sheet containing the code if it's in a worksheet code module); the other is that the values actually don't match your criteria - remember that your text criteria are case sensitive.
    Everyone who confuses correlation and causation ends up dead.

  6. #6
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    640

    Re: if statement not producing value expected

    Example of the data attached, and I've copied and pasted the text values from Excel to the VBA code

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,985

    Re: if statement not producing value expected

    You didn't address my first point, which is probably the most likely. When you open the template workbook, it becomes active, so this line refers to its active sheet:
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    640

    Re: if statement not producing value expected

    How many times do I have to get caught out by the same bloody mistake, Romper you've saved my Hiney again mate

    Cheers

+ 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. Replies: 2
    Last Post: 08-24-2014, 04:56 AM
  2. 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
  3. [SOLVED] Nested IF AND statement producing #NAME?
    By Jim15 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 06-28-2013, 01:20 PM
  4. Replies: 4
    Last Post: 05-16-2012, 05:33 PM
  5. Macros: Data cleaning macros not producing expected outputes.
    By bertlogdi1 in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 06-17-2011, 06:52 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