PC Review


Reply
Thread Tools Rate Thread

diff between used range row and lastrow

 
 
=?Utf-8?B?SnVuaW9yNzI4?=
Guest
Posts: n/a
 
      22nd Nov 2007
Hi ,

Can someone advise me the difference between if i use
activeworkbook.usedrange.row vs if i use lastrow=row.count.xl.up? Which
should i use if i want to delete those blank rows that are copy from another
wksheet via macro so that the last row will be the one with the data?

thanks,
 
Reply With Quote
 
 
 
 
ward376
Guest
Posts: n/a
 
      22nd Nov 2007
I've gotten a lot of mileage and no errors using find in functions to
identify last rows/columns in many different situations.

Check out http://www.rondebruin.nl/tips.htm. Look at copy/paste/merge
to find examples of these functions.

Cliff Edwards


 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      22nd Nov 2007
As you say the LastCell and UsedRange can extend below and to the right of
the last cell that has a value. Normally that's due to formats. To get the
last cell with an entry try -

With ActiveSheet
lastCol = .Cells.Find("*", .Range("A1"), xlFormulas, xlPart, _
xlByColumns, xlPrevious, False).Column
lastRow = .Cells.Find("*", .Range("A1"), xlFormulas, xlPart, _
xlByRows, xlPrevious, False).Row
End With

Above should work 99.99% of the time but in very rare scenarios can error.

Regards,
Peter T


"Junior728" <(E-Mail Removed)> wrote in message
news:3FEF78AB-E6A3-4144-86CC-(E-Mail Removed)...
> Hi ,
>
> Can someone advise me the difference between if i use
> activeworkbook.usedrange.row vs if i use lastrow=row.count.xl.up? Which
> should i use if i want to delete those blank rows that are copy from

another
> wksheet via macro so that the last row will be the one with the data?
>
> thanks,



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy range C5:Lastrow and paste to two different worksheets PVANS Microsoft Excel Programming 1 7th Apr 2010 09:58 AM
HELP Lastrow Range Mr. Damon Microsoft Excel Misc 1 29th Jul 2008 01:21 PM
Lastrow of a range davethewelder Microsoft Excel Programming 2 15th Apr 2008 01:42 PM
Defining Named Range for Lastrow in a specific column =?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?= Microsoft Excel Misc 5 9th May 2007 08:55 PM
Lastrow in Range =?Utf-8?B?SmVmZg==?= Microsoft Excel Misc 2 17th Dec 2004 04:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:50 AM.