LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default FINDING LAST ROW OF THE DATA

You're welcome :-)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"SUDHENDRA" wrote in message
...
THANKS
-----Original Message-----
Won't always work though.

Open up a new sheet, populate cells D10:F15 and then try

that code. It will
give you 3 for the last column (Should be 6) and 6 for

the last row (Should be
15). It counts the rows/columns *within* the UsedRange

and does not necessarily
give you the last of either.

lcol = ActiveSheet.UsedRange.Column - 1 + _
ActiveSheet.UsedRange.Columns.Count

lrow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count

Take lcol with example ranges I gave you above:-

ActiveSheet.UsedRange.Column will give you the first

column in the range, ie 4
ActiveSheet.UsedRange.Columns.Count will give you the

number of columns in that
range ie 3
Add the first column to the number of columns and you

will always have 1 more
than the last column, hence the -1 in there. Same

principle for rows.

--
Regards
Ken....................... Microsoft MVP -

Excel
Sys Spec - Win XP Pro / XL 00/02/03

---------------------------------------------------------

-------------------
It's easier to beg forgiveness than ask permission :-)
---------------------------------------------------------

-------------------



"pikus " wrote in

message
...
I asked this question not long ago and my personal

favorite answer is:

colCount = ActiveSheet.UsedRange.Columns.Count

It also works with Rows. - Pikus


---
Message posted from http://www.ExcelForum.com/



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system

(http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date:

02/01/2004


.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004


 
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
Finding Data Mike Excel Discussion (Misc queries) 2 October 13th 09 03:24 PM
Finding data Byron720 Excel Discussion (Misc queries) 5 September 29th 09 10:54 PM
Finding Data Tabatha Excel Worksheet Functions 3 February 25th 09 05:08 PM
Finding data Finder2000 Excel Discussion (Misc queries) 1 August 8th 06 07:34 PM
finding data SheriTingle Excel Worksheet Functions 2 July 12th 05 08:23 PM


All times are GMT +1. The time now is 05:32 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"