VBA - .End(xlDown)

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hi
I have a column in my spreadsheet that contains the column header one or
more items underneath. Is there a generic method to select all the items
underneath?

I have tried...

Set myRange = myWorksheet.Range("A2")
Set myRange = myWorksheet.Range(myRange , myRange.End(xlDown))

....but if the column only contains one item, the range is from that item to
the bottom of the spreadsheet.
 
one way:

With myWorksheet
Set myRange = .Range("A2:A" & _
.Range("A" & .Rows.Count).End(xlUp).Row)
End With
 
Back
Top