+ Reply to Thread
Results 1 to 4 of 4

best way to select the last row in a sheet

  1. #1
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    best way to select the last row in a sheet

    Hello. I saw this code
    Please Login or Register  to view this content.
    as a way to get to the last active row. However, I've seen it done another more common way, but I forget the code. Which way is best?

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,037

    Re: best way to select the last row in a sheet

    Use this:
    Please Login or Register  to view this content.
    Never use Merged Cells in Excel

  3. #3
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: best way to select the last row in a sheet

    But what's the difference?

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: best way to select the last row in a sheet

    Just a couple of points to note:

    UsedRange.Rows.Count will get you the lastrow used row for the whole worksheet. This may not be what you want (e.g. Maybe you have subtotal rows you don't want to include). While zbor's way will be column specific. Another iteration of UsedRange.Rows.Count is the use of specialcells. ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row.

    One more point. Specifying a numerical row using zbor's example could be problematic depending on the version of excel. Generally, this is more acceptable:

    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)

Similar Threads

  1. with userform select sheet and date and get data into result sheet
    By James__S in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-14-2014, 10:31 AM
  2. select a sheet from a drop down menu and move the row in the selected sheet
    By AlienPump in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-27-2012, 02:21 PM
  3. Select data in Sheet 2 based on column values in Sheet 1
    By Snehith in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2011, 08:52 PM
  4. Select sheet inside or outside other select
    By MadRue in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2007, 07:13 PM
  5. How do I select price from sheet.b where sheet.a part no = sheet.b
    By Sonny in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-04-2006, 12:10 PM

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