+ Reply to Thread
Results 1 to 4 of 4

Select a range of rows based on start row and end row being values in two worksheet cells

  1. #1
    Registered User
    Join Date
    10-07-2012
    Location
    sydney,australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Select a range of rows based on start row and end row being values in two worksheet cells

    Hi I am new to VBA can someone please help with this. I have scoured through many pages of threads and seen similar queries but my lack of VBA knowledge prevents me adapting some of the other solutions to my needs.

    If I record a macro to select a range of rows I get something like this (in part)...
    Rows("160:165").Select

    I would like the range to be a variable based on cells in the worksheet that I can change, thereby the selected range will change

    for example,

    if cell A1=160 and cell A2=165 , rows 160 to row 165 would be selected

    or

    if cell A1=120 and cell A2=135 , rows 120 to row 135 would be selected

    thanks

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,997

    Re: Select a range of rows based on start row and end row being values in two worksheet ce

    One way:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    10-07-2012
    Location
    sydney,australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Select a range of rows based on start row and end row being values in two worksheet ce

    Thanks very much Trevor. It works perfectly.

    [This is my first post to a forum. I hope my etiquette is OK.]

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,997

    Re: Select a range of rows based on start row and end row being values in two worksheet ce

    You're welcome. No complaints from me.

+ 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