+ Reply to Thread
Results 1 to 3 of 3

Thread: VBA Select mutiple rows (ending range variable)

  1. #1
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    242

    VBA Select mutiple rows (ending range variable)

    OK - I cant figure this out. Trying to teach myself the VBA code language and it just isn't working....and a google search isn't helping either.


    Two Questions that both refer to when the end range value varies.
    (1) - How do I select rows in VBA when I know the starting row number. - e.g: Row 23 (but my only referrence on where to end the range is how many rows have data in them when looking at Column D?)
    (2) - How do I select rows in VBA based off the current active cell using Offset - (meaning my starting range value is the current active cell. (but my only referrence on where to end the range is how many rows have data in them when looking at Column D?)

    Does this make sense?

    I know this is wrong, but this is what I have:
    Rows(23 & : & D" & Rows("23").End(xlDown).Row).Select

    I have upload a reference file, if needed. Sample 12-30.xlsm

    Thanks in advance.
    Last edited by clemsoncooz; 12-30-2011 at 03:16 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2009
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    986

    Re: VBA Select mutiple rows (ending range variable)

    Rows("23:" & Cells(Rows.Count, 4).End(xlUp).Row).Select
    
    Your answer to your 2nd question
    Rows(ActiveCell.Row & ":" & Cells(Rows.Count, 5).End(xlUp).Row).Select
    To thank someone who has helped you, click on the star icon below their name.

    I hate reading

    Portfolio

    I need a job.
    I am young and incompetent

  3. #3
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    242

    Re: VBA Select mutiple rows (ending range variable)

    Quote Originally Posted by JieJenn View Post
    Rows("23:" & Cells(Rows.Count, 4).End(xlUp).Row).Select
    
    Your answer to your 2nd question
    Rows(ActiveCell.Row & ":" & Cells(Rows.Count, 5).End(xlUp).Row).Select
    THANK YOU! Certainly solves the first question, perfectly.
    But doesn't solve my second question - but I don't really NEED to know that right now. My issues pertaining to my work is answered (thanks to you). The second question was for my own knowledge. Marking the thread as SOLVED.

+ 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.2.0