+ Reply to Thread
Results 1 to 4 of 4

Finding the last cell in a column based on cell contents

  1. #1
    Registered User
    Join Date
    03-22-2005
    Posts
    31

    Finding the last cell in a column based on cell contents

    Hi all,

    I've had a look around the net but haven't been able to find an answer to my question.

    I'm trying to write a code to select a range starting at cell B4 and ending at the last cell within the same column which doesn't contain the word "Nil"

    In otherwords my spreadsheet contains a number of formulas like so:

    B4 =if(A4="","Nil","<text>")
    B5 = if(A5="","Nil","<text>")
    B6 =if(A6="","Nil","<text>")
    etc.

    This continues to B20.

    The code needs to select from range B4 to the last cell in column B which has an 'if' false value in it - in otherwords find the last cell with Nil in it then offset it by -1. The answers will always be in order starting at B4 so there won't be gaps or any Nil answers between the false answers.

    Hope this makes a bit of sense - it's just hard to explain.

    Thanks all,

    AA
    Last edited by carlito_1985; 01-14-2011 at 05:06 AM. Reason: Solved

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Finding the last cell in a column based on cell contents

    Not entirely sure I can follow your logic re: ordering etc but it's early... that said here's one possibility:

    Please Login or Register  to view this content.
    though I'd add you rarely need to .Select anything.

  3. #3
    Registered User
    Join Date
    12-13-2007
    Posts
    10

    Re: Finding the last cell in a column based on cell contents

    That should do the trick.
    Last edited by atlas_85; 01-14-2011 at 05:04 AM.

  4. #4
    Registered User
    Join Date
    03-22-2005
    Posts
    31

    Re: Finding the last cell in a column based on cell contents

    Thanks for all your help. Works perfectly

    AA

+ 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