There is some useful code here here for finding the true used range in
Excel:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=82
From that:
Sub lrow()
Dim lastrow
lastrow = Cells.Find(What:="*", After:=Range("A1"), LookIn:=xlValues,
LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
MsgBox lastrow
End Sub
--
Steve
"FSPH" <(E-Mail Removed)> wrote in message
news:172B7524-F20B-401C-A5F4-(E-Mail Removed)...
> Hello there,
>
> Several of my worksheets contain a column (e.g., colum 5) of data with
> varying length. Worksheet 1 may have 10 rows of data, worksheet 2 with 20
> rows of data. The first two rows are occupied by the header on all
> worksheets.
>
> How can I count the maximum of rows with data?
>
> I encountered this code: Cells(Rows.Count, "a").End(xlDown).Row
> but unfortunately it doesn't work properly (probably because I don't
> understand what exactly the code is doing).
>
> Thank you, I would be grateful for your help.