Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Select every other row

  1. #11
    MrExcel MVP Russell Hauf's Avatar
    Join Date
    Feb 2002
    Location
    Portland, OR Area - USA
    Posts
    1,607
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-05 14:47, Jay Petrulis wrote:
    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
    Actually, this would hide the rows that are showing and unhide the hidden rows...

    You could do something like this though:

    Sub ShowHideAltRows(blnHide as Boolean)
    For x = 2 To 200 Step 2
    Cells(x, 1).EntireRow.Hidden = blnHide
    Next
    End Sub

    Then call it from another procedure:

    Sub HideAlternates()
    Call ShowHideAltRows(True)
    End Sub

    [ This Message was edited by: Russell Hauf on 2002-04-05 15:02 ]

  2. #12
    New Member
    Join Date
    Apr 2005
    Location
    EU: Hellas: Stylida
    Posts
    34
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Great job everyone.

    So how about auto-selecting every other row?

  3. #13
    New Member
    Join Date
    Dec 2008
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Select every other row

    Looks like its been a couple of years since this thread was created, but one solution I've used is to insert a new column, fill it with alternating values (ie A then B then A then B etc.) and then Sort Ascending. This at least puts all the Even and Odd rows in groups.

    For example put an "A" in all the odd columns and "B" in all the even columns (by putting an A in the first row, B in the second row, highlighting them and then dragging the little+ down for however many rows you need), and then selecting the whole worksheet (click on the box above row 1 and to the left of column A) and then click on the A->Z Sort Ascending.

  4. #14
    New Member
    Join Date
    Apr 2013
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Select every other row

    Quote Originally Posted by swaink View Post
    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
    This is quite simple:

    Select the cells you wish to format:

    Go to Conditional format
    Select Highlight Cell Rules
    Select More Rules
    Select Uase a formula to determine cells to format
    Enter: =MOD(ROW(),2)
    Format what colour you like
    Press OK

    Tad dar

  5. #15
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    37,991
    Post Thanks / Like
    Mentioned
    61 Post(s)
    Tagged
    12 Thread(s)

    Default Re: Select every other row

    Quote Originally Posted by Jaywar2013 View Post
    This is quite simple:

    Select the cells you wish to format:

    Go to Conditional format
    Select Highlight Cell Rules
    Select More Rules
    Select Uase a formula to determine cells to format
    Enter: =MOD(ROW(),2)
    Format what colour you like
    Press OK

    Tad dar
    Welcome to the MrExcel board!
    Interesting first post.
    I can't help wondering ..

    - if swaink is still interested in this 11 years later?

    - how this would help hide the rows, which is what swaink wanted to do? (see post #5)
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the VBHTML Maker
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

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
  •