Hi John,
To select the used range minus the top header, you can use the following VBA code:
Formula:
[b]Dim lastRow As Long
Dim rng As Range[/b]
[b]lastRow[/b] = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
[b]Set rng[/b] = Range("A2").Resize(lastRow - 1, ActiveSheet.UsedRange.Columns.Count)
[b]rng.Select[/b]
This code first finds the last row of data in column A using the
End method. Then it sets a range object
rng to start from cell A2 and extend to the last row of data minus one (to exclude the header row), and to cover all columns in the used range. Finally, it selects the
rng range.
- Declare variables lastRow and rng as Range.
- Find the last row of data in column A using the End method.
- Set the rng range object to start from cell A2 and extend to the last row of data minus one (to exclude the header row), and to cover all columns in the used range.
- Select the rng range.