Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default End(XlDown).Row - Problem if only 1 row

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default End(XlDown).Row - Problem if only 1 row

Use something like Cells(8, 65536).End(xlUp).Row

RBS


"Ed Peters" wrote in message
oups.com...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default End(XlDown).Row - Problem if only 1 row

Substitute this line:

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

- David

On Sep 12, 3:44 pm, Ed Peters wrote:
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



Reply
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
xlDown going further than data Astello[_2_] Excel Programming 2 November 15th 06 07:45 PM
End(xlDown) won't work mike Excel Programming 12 September 16th 06 08:50 AM
End(xldown) not always going to last cell? Duncan[_5_] Excel Programming 6 May 4th 06 10:30 AM
XlDown: Go to next blank row tomwashere2 Excel Programming 2 August 16th 05 11:15 PM
xldown and xlright He4Giv Excel Programming 2 January 29th 04 12:41 AM


All times are GMT +1. The time now is 12:18 AM.

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

About Us

"It's about Microsoft Excel"