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: 9
Default counting # rows in a worksheet

- IF you delete rows/columns it doesn't work ...

UsedRange.Range gets the MAXIMUM RANGE not the REAL range !!!

" wrote:

Tonhao,

Why not simply use:

Public Function lastRowNbr(Optional colRef As Variant) As Long

If IsMissing(colRef) Then
'Give last row of the longest column
lastRow = ActiveSheet.UsedRange.Rows.Count
Else
'Give last row of the identified column
lastRow = Cells(Rows.Count, colRef).End(xlUp).Row
End If

End Function


Brian M



 
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
Counting rows??? Lockedhart Excel Discussion (Misc queries) 6 July 30th 08 06:26 PM
Counting characters in multiple rows when rows meet specific criteria news.virginmedia.com Excel Worksheet Functions 3 June 28th 08 09:03 PM
Counting Rows klafert Excel Discussion (Misc queries) 0 September 14th 06 06:37 PM
Counting Rows CLamar Excel Discussion (Misc queries) 1 June 15th 06 04:05 PM
Counting rows, then counting values. Michael via OfficeKB.com Excel Discussion (Misc queries) 7 August 4th 05 10:57 PM


All times are GMT +1. The time now is 12:34 PM.

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"