I'm not sure what the PURPOSE of your macro is, so here's some
possibilities:
Keep in mind that the Cells format is:
Cells(row,column),
so C5 is cells(5,3)
now, it looks like your script is simply to select a
set of rows, not necessarily those in the range.
Let's say I have a Range(A8:D20) named "TestRange".
But only have Data in A8-A14.
The UsedRange.Rows.Count method actually returns the row
number of the last cell with content (row 14).
But your .Select statement can select any number of cells,
independent on the Named Range, say: from row 2 thru lastrow,
which is more than the range, and does not have to even include
the range itself. Like:
lastrow = ActiveSheet.UsedRange.Rows.Count
With Worksheets(ActiveSheet.Name)
.Range(Cells(2, 7), Cells(lastrow, 17)).Select
End With
Of course, if you already know the column LETTERS, you could use:
lastrow = ActiveSheet.UsedRange.Rows.Count
With Worksheets(ActiveSheet.Name)
.Range("G2:Q" & lastrow).Select
End With
If your intent is to actually select the named range,
then you can simply use:
Range("TestRange").Select