Does anyone have vba that selects every other active row from current selection? Thanks.
Does anyone have vba that selects every other active row from current selection? Thanks.
Hi,
What do you mean by 'every other active row'. Active cell / active row has a special meaning in Excel and means the cell/row that is currently selected and hence can only mean one cell/row.
Richard Buttrey
RIP - d. 06/10/2022
If any of the responses have helped then please consider rating them by clicking the small star iconbelow the post.
This should select every alternate row from the activecell row within the used range
![]()
Sub Select_Alternate_Rows() Dim rAnswer As Range, iLastRow As Integer, iRow As Integer, i As Integer With ThisWorkbook.Worksheets("Sheet1") iLastRow = .UsedRange.Rows.Count + .UsedRange.Row - 1 If ActiveCell.Row Mod 2 = 0 Then i = 2 Else i = 1 Set rAnswer = .Range("A" & i) For iRow = i + 2 To iLastRow Step 2 Set rAnswer = Union(rAnswer, .Range("A" & iRow)) Next iRow End With rAnswer.EntireRow.Select Set rAnswer = Nothing End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks