Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Finding last row

hi gurus

I have a 'novice' question. It refers to a table that can a variable number
of rows and columns. The cells of the table have lined borders. The upper
left cell of the table is "A3". I need code that produces the row number
of the LAST row in the table. (This row may have values in its cells or its
cells may be empty.)


thanks a lot
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Finding last row

Try

Msgbox Cells(Rows.Count, "A").End(xlUp).Row

--
Jacob


"Victoria" wrote:

hi gurus

I have a 'novice' question. It refers to a table that can a variable number
of rows and columns. The cells of the table have lined borders. The upper
left cell of the table is "A3". I need code that produces the row number
of the LAST row in the table. (This row may have values in its cells or its
cells may be empty.)


thanks a lot

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Finding last row

hi Jacob - your code snippet works well when there is an entry in the cell.
But the cells may be empty. Every cell in the table has a line border on
all 4 sides (When printed, many cells will be empty, but workers fill in
values for later data entry.) What I need is to be able to identify the row
number of the last formatted row.

Thanks
Victoria

"Jacob Skaria" wrote:

Try

Msgbox Cells(Rows.Count, "A").End(xlUp).Row

--
Jacob


"Victoria" wrote:

hi gurus

I have a 'novice' question. It refers to a table that can a variable number
of rows and columns. The cells of the table have lined borders. The upper
left cell of the table is "A3". I need code that produces the row number
of the LAST row in the table. (This row may have values in its cells or its
cells may be empty.)


thanks a lot

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Finding last row

--Which version of XL do you use...
--Are you referring to 2007 table

--
Jacob


"Victoria" wrote:

hi Jacob - your code snippet works well when there is an entry in the cell.
But the cells may be empty. Every cell in the table has a line border on
all 4 sides (When printed, many cells will be empty, but workers fill in
values for later data entry.) What I need is to be able to identify the row
number of the last formatted row.

Thanks
Victoria

"Jacob Skaria" wrote:

Try

Msgbox Cells(Rows.Count, "A").End(xlUp).Row

--
Jacob


"Victoria" wrote:

hi gurus

I have a 'novice' question. It refers to a table that can a variable number
of rows and columns. The cells of the table have lined borders. The upper
left cell of the table is "A3". I need code that produces the row number
of the LAST row in the table. (This row may have values in its cells or its
cells may be empty.)


thanks a lot

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Finding last row

hi again

I'm using Excel 2002. I'm not sure what you mean by a '2007 table', but I'm
simply refering to an area of the Sheet that has bordered cells. If printed,
it would look like a sheet of graph paper. I need to be able to identify the
last row, even if its cells contain no values.

Sorry if I'm using terms improperly
Victoria

"Jacob Skaria" wrote:

--Which version of XL do you use...
--Are you referring to 2007 table

--
Jacob


"Victoria" wrote:

hi Jacob - your code snippet works well when there is an entry in the cell.
But the cells may be empty. Every cell in the table has a line border on
all 4 sides (When printed, many cells will be empty, but workers fill in
values for later data entry.) What I need is to be able to identify the row
number of the last formatted row.

Thanks
Victoria

"Jacob Skaria" wrote:

Try

Msgbox Cells(Rows.Count, "A").End(xlUp).Row

--
Jacob


"Victoria" wrote:

hi gurus

I have a 'novice' question. It refers to a table that can a variable number
of rows and columns. The cells of the table have lined borders. The upper
left cell of the table is "A3". I need code that produces the row number
of the LAST row in the table. (This row may have values in its cells or its
cells may be empty.)


thanks a lot



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Finding last row

Hi Victoria

Microsoft has introduced a new concept of working with tables of data in
Excel 2007. This new functionality is called "tables" which is the successor
of Excel 2003's "List" feature........

If you are having a list you can try
Activesheet.ListObjects(1).listrows.count

If not a list but only formatted with borders... Then try the below macro
Sub Macro()

Dim lngRow As Long
lngRow = 3
Do: lngRow = lngRow + 1
Loop Until Range("A" & lngRow).Borders.LineStyle = xlLineStyleNone
lngRow = lngRow - 1

End Sub

--
Jacob


"Victoria" wrote:

hi again

I'm using Excel 2002. I'm not sure what you mean by a '2007 table', but I'm
simply refering to an area of the Sheet that has bordered cells. If printed,
it would look like a sheet of graph paper. I need to be able to identify the
last row, even if its cells contain no values.

Sorry if I'm using terms improperly
Victoria

"Jacob Skaria" wrote:

--Which version of XL do you use...
--Are you referring to 2007 table

--
Jacob


"Victoria" wrote:

hi Jacob - your code snippet works well when there is an entry in the cell.
But the cells may be empty. Every cell in the table has a line border on
all 4 sides (When printed, many cells will be empty, but workers fill in
values for later data entry.) What I need is to be able to identify the row
number of the last formatted row.

Thanks
Victoria

"Jacob Skaria" wrote:

Try

Msgbox Cells(Rows.Count, "A").End(xlUp).Row

--
Jacob


"Victoria" wrote:

hi gurus

I have a 'novice' question. It refers to a table that can a variable number
of rows and columns. The cells of the table have lined borders. The upper
left cell of the table is "A3". I need code that produces the row number
of the LAST row in the table. (This row may have values in its cells or its
cells may be empty.)


thanks a lot

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
Finding 1st,2nd,3rd etc checkQ Excel Discussion (Misc queries) 5 May 19th 08 12:38 AM
finding a tab name tigoda Excel Programming 2 May 14th 07 02:49 PM
Finding last used mikefranklin1969 Excel Worksheet Functions 1 May 12th 06 10:05 PM
finding the "end" Julia New Users to Excel 2 September 1st 05 02:38 AM
Finding Last Row Clint[_4_] Excel Programming 1 July 23rd 04 03:05 PM


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