+ Reply to Thread
Results 1 to 6 of 6

VBA to select last row

  1. #1
    Forum Contributor
    Join Date
    07-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    139

    VBA to select last row

    I am trying to select all cells in cols A-K LASTROW ONLY and I keep running into Method of Range errors. Can some one please point to where my mistake is with the Range.Select statement?

    Thank You

    Please Login or Register  to view this content.

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: VBA to select last row

    This should do it

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Forum Contributor
    Join Date
    07-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: VBA to select last row

    Mike,

    thank you, but that selects ALL cells to the last row in Col K. I only need the cells in the last row.

    For example if last row is 18, would be A18-K18, but I cannot seem to get it by using lastrow.

    I need to use lastrow (dynamic rather than static) is because the procedure this is in gets run against several sheets and each one has a different amount of records on it.

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: VBA to select last row

    Then this will work

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-03-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: VBA to select last row

    Sweet, thank you, and I see where I was missing it with my several itterations and attemtps!!

    Here is what I had that did not work, I was close !! lol

    Please Login or Register  to view this content.
    Damned quotes get me all the time!

    Thanks again for this, i appreciate it.

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: VBA to select last row

    This would be better and proper

    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)

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