+ Reply to Thread
Results 1 to 6 of 6

Selecting ranges in a range

  1. #1
    Forum Contributor
    Join Date
    09-30-2015
    Location
    LA my baby
    MS-Off Ver
    2013
    Posts
    727

    Selecting ranges in a range

    Hello. Why doesn't this code work to select row ranges in a range? I want to select B6:N6 and so on down the identified range.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Selecting ranges in a range

    rambo.Select
    Each cell in a range

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

    Re: Selecting ranges in a range

    You remind me of ammartino44. Are you the alias?

    Anyways, in response to your question the variable rambo would be what you would use to select the range within the loop. rambo.Select. If you want the entire row it would be rambo.entirerow.select
    If you are happy with my response please click the * in the lower left of my post.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,802

    Re: Selecting ranges in a range

    AB33's code will, as noted, select each cell individually iterating through the range.

    If you want to select one row at a time, then use this

    Please Login or Register  to view this content.
    However, be aware that this code doesn't really do anything. It just moves the selection around.
    Last edited by 6StringJazzer; 01-20-2016 at 03:13 PM. Reason: made a couple of corrections to the code
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Forum Contributor
    Join Date
    09-30-2015
    Location
    LA my baby
    MS-Off Ver
    2013
    Posts
    727

    Re: Selecting ranges in a range

    @ stynkynts. I am!! I'm famous Thanks.

    @Stringer. Your code is what I was looking. What makes it select by entire range row as opposed to cell or the entire row?

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,802

    Re: Selecting ranges in a range

    .Rows is the attribute of a range that returns a collection of Rows within that range. The For loop iterates through those rows, assigning each row to rambo.

    If you highlight a method or attribute in the VBA code window then hit F1, it will bring up a Help page for that attribute. Try it with your code and Rows.

+ 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. [SOLVED] error 1004 Method 'Range' of object '_Worksheet' failed when selecting multiple ranges
    By Edejager in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2013, 07:51 AM
  2. Selecting Ranges
    By halfthumb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2013, 04:08 PM
  3. Replies: 0
    Last Post: 03-30-2012, 01:56 PM
  4. Error When Selecting Sheet then Selecting Range
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-08-2012, 04:11 AM
  5. Selecting Ranges Using VBA
    By mattydalton in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-21-2008, 11:01 AM
  6. selecting ranges
    By twychopen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2007, 09:55 PM
  7. Selecting First and Last Cells in Ranges
    By Magnivy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2006, 11:50 PM
  8. Selecting Ranges
    By Barb Reinhardt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2006, 03:30 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