D/Mike
I tried your code and did not meet my needs as I mentioned before, I do have
in col-A, serial number 1 to 50 and again from a70 to a150.
By using xlup it takes the last row as 150 but I want it to take the row 50
in this case. For this the sugestion xldown helps.
Thank you for the sugestion of "Set myrange = Range("A5:A" &
lastrow).Resize(, 6) " which was good to note.
brgds/captgnvr
"Mike H" wrote:
Hi,
XlDown won't necessarily get you the last populated cell so I've use Xlup
instead
Public Sub LASTTROW()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set myrange = Range("A5:A" & lastrow).Resize(, 6)
myrange.Select
End Sub
Mike
"CAPTGNVR" wrote:
DEAR ALL
Active cell is A5. I need to select the range from 5th row to the last
populated cell which is obtained from xldown.row to 5 columns to the right.
Public Sub LASTTROW()
LASTROW = ActiveCell.End(xlDown).Row
ActiveCell.Range(Cells(0, 0), Cells(LASTROW, 5)).Select
End Sub
What is wrong in this code to get run time error 1004- 'application-defined
or object defined error'.
or sugest VB to mark from the active cell to last populated row and 5
columns to the right.
pls help-captgnvr