+ Reply to Thread
Results 1 to 5 of 5

Use evaluate instead of range in VBA IF statement

  1. #1
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    326

    Use evaluate instead of range in VBA IF statement

    Hi,

    I'm trying to figure out why a simple IF statement using a range name isn't working:

    Please Login or Register  to view this content.
    The line in bold always blows up. What am I doing wrong?

    Lawrence
    Attached Files Attached Files
    Last edited by skysurfer; 07-29-2010 at 06:06 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to write a simple IF statement using a range name

    It's a multi-cell range. You can't compare an array to a single value.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    326

    Re: How to write a simple IF statement using a range name

    shg,

    Thanks.

    But then how do I write the formula so that it the macro executes when the item count in the range "ListItemsCount" is greater than 0?

    Is the only way to have the range name refer to only one cell?

    Lawrence

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to write a simple IF statement using a range name

    My mistake, ListItemsCount is not a range, it's a value.

    Please Login or Register  to view this content.
    You need to do a better job with thread titles, please. Read the part about "concise."

  5. #5
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    326

    Re: How to write a simple IF statement using a range name

    shg,

    THANKS!

    As for the title, will do...and post the updated file for future reference.

    Lawrence
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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