View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1524_] Rick Rothstein \(MVP - VB\)[_1524_] is offline
external usenet poster
 
Posts: 1
Default Unable to mark the range in VB and get application error- WHY

While I recognize the OP has finished with this thread, I thought I would
add my comment for the archives at least. Considering the OP said he had A5
set as the selected cell; assuming selecting a starting cell before running
the macro is how the OP always proceeds, then your Range-approach solution
can be shortened down even further to this one-liner...

Range(ActiveCell, ActiveCell.End(xlDown)).Select

Rick


"Mark Ivey" wrote in message
...
Consider this....

If I fully understand your request, give this snippet a go...


Mark



LastRow = Range("A5").End(xlDown).ROW

Range("A5:E" & LastRow).Select









"CAPTGNVR" wrote in message
...
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