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
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Just manually? Hold the ctrl key while you click on row numbers.
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
Daleyman

Yep that looks like just the thing I need thank you

And thanks to everyone for your response's

Kev
 
Upvote 0
Sub hide_Alternates()
For x = 2 To 200 Step 2
Cells(x, 1).EntireRow.Hidden = True 'switch =False to unhide
Next
End Sub
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,528
Messages
6,114,154
Members
448,553
Latest member
slaytonpa

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