Select each alternate row in a worksheet

  • Thread starter Thread starter Abdul Shakeel
  • Start date Start date
A

Abdul Shakeel

Hi all,

Could I select each alternate row in my seleceted range of a worksheet,
there is any way to do this.
 
Try this macro:

Sub everyothre()
Set s = Selection
r1 = s.Cells(1, 1).Row
r2 = s.Rows.Count + r1 - 1
Set cmp = s.Cells(1, 1).EntireRow
For i = r1 To r2 Step 2
Set parts = Cells(i, 1).EntireRow
Set cmp = Union(cmp, parts)
Next
Set cmp = Intersect(cmp, s)
cmp.Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top