Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

End(XlDown).Row -  Problem if only 1 row

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed Peters - 12 Sep 2007 20:44 GMT
Hi all,

I use the End(xldown).Row for splitting up a a file on import.

With ActiveSheet
   LastCell8 = .Range("h1").End(xlDown).Row

    .Range("m1").Copy
   .Range("m2:m" & LastCell8).Select
   .Paste
End With

However sometimes the import file is only 1 row and it ends up
selecting all 65,000 rows ...

Any thoughts how I can work this out bearing in mind I've already
written code using the above.

Thanks.

Ed
RB Smissaert - 12 Sep 2007 20:59 GMT
Use something like Cells(8, 65536).End(xlUp).Row

RBS

> Hi all,
>
[quoted text clipped - 17 lines]
>
> Ed
David Hilberg - 12 Sep 2007 21:11 GMT
Substitute this line:

lastcell8 = .Range("h1").End(xlDown).End(xlDown).End(xlUp).Row

- David

> Hi all,
>
[quoted text clipped - 17 lines]
>
> Ed
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.