+ Reply to Thread
Results 1 to 7 of 7

Setting Range based on LastCell

  1. #1
    Forum Contributor
    Join Date
    05-18-2004
    Location
    Portland, Oregon
    MS-Off Ver
    2016
    Posts
    182

    Setting Range based on LastCell

    Hello Again,

    I am updating some code that allows me to ask users when they change a cell if they "are sure they want to make the change". Current code is posted below for your reference. I am interested in figuring out how to make a static range actually based on the LastCell.

    See in the below code the rng is = to A8:BB50000. I would like it to be set for A8:LastCell

    Please Login or Register  to view this content.
    Below is the code in it's entirety.
    Thanks for your help!

    Cheers,
    Matt

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 11-21-2008 at 04:46 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    05-18-2004
    Location
    Portland, Oregon
    MS-Off Ver
    2016
    Posts
    182
    Hello RoyUK,

    Can you explain how this works?

    Thanks,
    Matt

  4. #4
    Forum Contributor
    Join Date
    05-18-2004
    Location
    Portland, Oregon
    MS-Off Ver
    2016
    Posts
    182
    I can't get it to work...in fact now none of the original code works, even when I go back to the first static selection.

    Weird.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The range is set to A1 to the last cell in BB

  6. #6
    Forum Contributor
    Join Date
    05-18-2004
    Location
    Portland, Oregon
    MS-Off Ver
    2016
    Posts
    182
    Hello,

    I don't know what the last cell is, or the last column, I need it to fingure that part out.

    Perhaps I need to reset the last cell. I am pretty new to this. I just know I want my original code to be a little more dynamic so it doesn't try to execute for every cell changed...only those A8:LastRow and Row7:LastColumn. That would be the way to find the last cell, right??

    Regards,
    Matt

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You had the range hard coded as "A7:BB5000", that's why I used that column. maybe
    using UsedRange would be best.

    Please Login or Register  to view this content.

+ 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