Select every other row

swaink

Active Member
Joined
Feb 15, 2002
Messages
432
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
 
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
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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.
 
Upvote 0
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
 
Upvote 0
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? :eek:

- how this would help hide the rows, which is what swaink wanted to do? (see post #5)
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,216
Members
448,876
Latest member
Solitario

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top