Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Select every other row

  1. #1
    Board Regular swaink's Avatar
    Join Date
    Feb 2002
    Location
    51.421818,-0.977139
    Posts
    432
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi everyone

    Im trying to find a way select several rows at the same time but starting at say row 3 and then alternate rows so rows 3,5,7,9 etc

    Can anyone advise please

    regards

    Kevin

  2. #2
    MrExcel MVP Anne Troy's Avatar
    Join Date
    Feb 2002
    Location
    Westwood NJ
    Posts
    2,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Just manually? Hold the ctrl key while you click on row numbers.
    ~Anne Troy

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    359
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Are you trying to do that manually or from a macro?

  4. #4
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You can adapt this to your needs and maybe throw it in a for loop or something.

    Range("3:3,5:5,7:7,9:9").Select

    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  5. #5
    Board Regular swaink's Avatar
    Join Date
    Feb 2002
    Location
    51.421818,-0.977139
    Posts
    432
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I would prefer doing it by macro if i can as there are some 200 rows that I'm looking to work with.

    I want to hide and unhide them again using code.

    Kev

  6. #6
    Board Regular swaink's Avatar
    Join Date
    Feb 2002
    Location
    51.421818,-0.977139
    Posts
    432
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Al

    Many thanks,I'll give that a try

    Kev

  7. #7
    Board Regular
    Join Date
    Mar 2002
    Location
    London, UK
    Posts
    167
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    well in that case you don't need to actually select them...


    Sub hide_alternates()
    For rowx = 2 To 200 Step 2
    Cells(rowx, 1).RowHeight = 0
    Next
    End Sub

    Sub unhide_alternates()
    For rowx = 2 To 200 Step 2
    Cells(rowx, 1).EntireRow.AutoFit
    Next
    End Sub

  8. #8
    Board Regular swaink's Avatar
    Join Date
    Feb 2002
    Location
    51.421818,-0.977139
    Posts
    432
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Daleyman

    Yep that looks like just the thing I need thank you

    And thanks to everyone for your response's

    Kev

  9. #9
    New Member
    Join Date
    Apr 2002
    Location
    Kansas
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sub hide_Alternates()
    For x = 2 To 200 Step 2
    Cells(x, 1).EntireRow.Hidden = True 'switch =False to unhide
    Next
    End Sub

  10. #10
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-05 14:05, jreeper wrote:
    Sub hide_Alternates()
    For x = 2 To 200 Step 2
    Cells(x, 1).EntireRow.Hidden = True 'switch =False to unhide
    Next
    End Sub
    Hi Jeff,

    Here is an interesting way to switch back and forth, rather than your commented out section (=false)

    ------------------
    Sub toggle_row_setting()

    Application.ScreenUpdating = False
    For x = 2 To 200 Step 2
    Rows(x).Hidden = Not Rows(x).Hidden
    Next
    Application.ScreenUpdating = True

    End Sub
    --------------------

    Same idea, less writing.

    Regards,
    Jay

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •