View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
just_jon
 
Posts: n/a
Default Using variables as first and last cells in range statement

A couple of ways below. Keep in mind that you do not need Select
statements to do most actions ...

Sub fooL()
Dim EndCell As Long
EndCell = Cells(Rows.Count, "D").End(xlUp).Row
Range("D" & FirstCell & ":D" & EndCell - 4).Select
End Sub

Sub fooR()
Dim EndCell As Range
Set EndCell = Cells(Rows.Count, "D").End(xlUp)
Range(EndCell.Offset(-4, 0), EndCell).Select
End Sub