View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ken Wright Ken Wright is offline
external usenet poster
 
Posts: 634
Default FINDING LAST ROW OF THE DATA

If you want the last used row or column anywhere in the sheet, then try the
following:-

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

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


If you want the last cell in a particular Column, then try:-

lrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

If you want the last cell in a particular Row, then try:-

lcol = ActiveSheet.Cells(2, Columns.Count).End(xlToLeft).Column

--
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
...
Hi

I have a worksheet with data, the data in each column is
not continous.

I want to find the last row of the data (the data is in
Column A to Column R) the data is not continus in any of
the columns.

Can anyone help in writing a VBA code in finding the last
row of data

thanks in advance



---
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