LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Unable to mark the range in VB and get application error- WHY

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



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to set the Display Alerts property of the application class PhilM[_2_] Excel Programming 6 June 29th 07 11:45 AM
Hiding Rows Error - "Runtime Error 1004 - Unable to set the hidden property of the range class" Punsterr Excel Programming 2 April 9th 07 05:32 PM
Unable to set the NumberFormat Property of the Range Class - ERROR Jon Delano Excel Programming 3 November 10th 04 07:33 PM
unable to close macro using auto_close or application.quit gloria Excel Programming 1 January 14th 04 07:50 AM
unable to set formulaarray of range class ERROR when using Conditional Sum John H.[_2_] Excel Programming 1 September 25th 03 09:55 PM


All times are GMT +1. The time now is 03:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"