Row Count Error
Hi Ron,
You are correct, although I didin't know what it was I didn't tell you about
until I did more experimenting. (Is that a double negative or something?)
Anyway, the problem was that the workbook (strSubWB) that I had opened was
from 2003 and had a .xls file extension.
If I open it in 2007 and save as .xlsx, the code works okay.
I have just begun to convert a slew of macros to 2007 and have a lot to
learn it seems.
Thanks all for your input.
--
Ken Hudson
"Ron Rosenfeld" wrote:
On Wed, 8 Oct 2008 16:58:10 -0700, Ken Hudson
wrote:
I have the following code:
dSubRows = Workbooks(strSubWB).Sheets(1).Cells(Rows.Count, "A").End(xlUp).Row
It works in Excel 2003 but not in Excel 2007.
Why not?
What do you mean when you write it does not work?
XL crashes?
Wrong result?
Some error message?
Since an equivalent to the right side of your statement works in my XL2007, the
problem is likely in something you have not told us about.
For example, this statement works as expected:
Debug.Print ThisWorkbook.Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
printing the number of the row just below the lowest occupied cell in column A.
--ron
|