How can I select a range using the activecell & lastrow or offset & lastrow?
How can I select a range using the activecell & lastrow or offset & lastrow?
[vba]
With ActiveCell
.Resize(.End(xlDown).Row - .Row + 1).Select
End With
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
...or perhaps:
[vba]Range(ActiveCell, ActiveCell.End(xlDown)).Select[/vba]
...or If you want to use a variable you can do this:
[vba]Dim lastRow as Long
lastRow = ActiveCell.End(xlDown).Row
Range(ActiveCell, ActiveCell.Offset(lastRow, 0)).Select[/vba]
I need to use the activecel and lastrow, but the lastrow based on column A if that makes sense
but i want be able to sayDim lastrow As Long lastrow = Cells(Rows.Count, "A").End(xlUp).Row range("b2:b" & lastrow)
Dim lastrow As Long lastrow = Cells(Rows.Count, "A").End(xlUp).Row Activecell & Lastrow
The clues were all there
[vba]
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
With ActiveCell
.Resize(LastRow - .Row + 1).Select
End With
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
thanks, again for all the help
...or this way:
[vba]Dim LastRow As Long
LastRow = Range("A65536").End(xlUp).Row
Range(ActiveCell.Address & "," & Range("B" & LastRow).Address).Select[/vba]
... for those of us who have never touched .Resize or .Count before.
You might want to try that!Originally Posted by n8Mills
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber