Hi Fad,
Pascal's code correctly provides for skipping over empty cells, but the
65536 would be best not used, in case Excel gets more rows,
it has happened. The number of columns hasn't changed since
Excel first started and is LONG overdue, and if it does get changed
you will have a mixture of people having one or the other for several
years.
The following would be equivalent and would continue to work in future,
and is based on Column A as Pascal's code, not on the lastcell as
maintained (or not) by Excel:
Dim rw as long '-- integer only goes to 32768
rw = Cells(Rows.Count, 1).End(xlUp).Row
Some useful macros that I have on my toolbar making use of this can be
found at
http://www.mvps.org/dmcritchie/excel/tools.htm#macros
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:
http://www.mvps.org/dmcritchie/excel/search.htm
papou said:
Hello Fad
Range("A65536").End(xlUp).Row
Which will give the last non empty row in column A.
HTH
Cordially
Pascal