Select Every nth Row in Excel
Sub SelectEveryNthRow()
ColsSelection = Selection.Columns.Count
RowsSelection = Selection.Rows.Count
RowsBetween = 3
Diff = Selection.Row - 1
Selection.Resize(RowsSelection, 1).Select
Set FinalRange = Selection. _
Offset(RowsBetween - 1, 0).Resize(1, ColsSelection)
For Each xCell In Selection
If xCell.Row Mod RowsBetween = Diff Then
Set FinalRange = Application.Union _
(FinalRange, xCell.Resize(1, ColsSelection))
End If
Next xCell
FinalRange.Select
End Sub
Written by Zhang Tai
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#