+ Reply to Thread
Results 1 to 2 of 2

using a cells postion/range in an if then statment

  1. #1
    Registered User
    Join Date
    10-09-2017
    Location
    Georgia
    MS-Off Ver
    7 professional
    Posts
    6

    using a cells postion/range in an if then statment

    All,

    I am trying to get an "if, then..." statement condition to be based on the position/range of a cell. Specifically I want my code to do exactly the flowing:

    if active cell is in column u (21) or greater (after) then
    do something


    what would be the best way to acheive this?


    I have been trying to use ActiveCell.Range and Range.Range with IS TRUE; the syntax I am using did not flag in red as a "syntax error", i.e.:

    Please Login or Register  to view this content.
    (column 30, AD is passed the end of the data columns, so it is just an end point to make the statement, effectually a greater than)

    but when I try to run the code it gives me this error: compile error: type mismatch. What would be the method/syntax to use?

    I have no way of predicting the values that will be in any cell or even if the cell is going to be null.

    excel version: 14.0.7232.5 32 bit
    operating system: windows 7 professional

    Thanks in advance
    Lconner_2

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    45,127

    Re: using a cells postion/range in an if then statment

    As an example,
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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: 4
    Last Post: 11-17-2015, 02:28 AM
  2. Issue with If and Range statment.
    By vop2311 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2014, 02:05 AM
  3. Replies: 2
    Last Post: 06-06-2012, 10:59 PM
  4. How to use an if statment to test for empty range
    By ducecoop in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-17-2008, 03:42 PM
  5. If statment to clear a range of cells
    By gthemerc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-16-2008, 05:10 PM
  6. If Statment range
    By Merlin2007 in forum Excel General
    Replies: 1
    Last Post: 04-21-2007, 09:23 PM
  7. variable range in a COUNTIF statment
    By Sabean in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2006, 08:10 AM

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