Unspecify Error in Range count

  • Thread starter Thread starter BinhNT
  • Start date Start date
B

BinhNT

I have the error with this statement:

MyRow = Workbooks("convert").Sheets("CNV").Cells(65536,
1).End(xlUp).Row()

The error "Subscript out of range". event it has been OK for running
thousand times before. I have remove Exel XP and reinstall it but it
still have error. Now, I use Office2003 but everything can not work.
May be it came from some update of my WindowsXP, but I have reinstall
my WindowsXP already.

Could you help me to solve this? Thanks much!
 
Sounds like the sheet name may be wrong.
Try to isolate the error..
break it out & see where the error comes

WITH Workbooks("convert").Sheets("CNV").
MyRow = .Range("A65000").End(xlUp).Row
END WITH

Note that there are no brackets round Row
.Row
not
.Row()


Patrick Molloy
Microsoft Excel MVP
 
Patrick said:
Sounds like the sheet name may be wrong.
Try to isolate the error..
break it out & see where the error comes

WITH Workbooks("convert").Sheets("CNV").
MyRow = .Range("A65000").End(xlUp).Row
END WITH

Note that there are no brackets round Row
.Row
not
.Row()


Patrick Molloy
Microsoft Excel MVP


Thanks Patrick,
I have tried to change, this time the error appears follow:
WITH Workbooks("convert").Sheets("CNV")

with the same description "Subscript out of range".
I also change it to
MyRow = Worksheets("CNV").Cells(65536,1).End(xlUp).Row()

and it works well. But this way is useful when I work in currently
workbook only and ofcourse I could not reference to worksheets in
another workbook. Sounds it needs some lib, but I do not know yet.
 
Does it work if you include the .xls?

WITH Workbooks("convert.xls").Sheets("CNV")......



Patrick said:
Sounds like the sheet name may be wrong.
Try to isolate the error..
break it out & see where the error comes

WITH Workbooks("convert").Sheets("CNV").
MyRow = .Range("A65000").End(xlUp).Row
END WITH

Note that there are no brackets round Row
.Row
not
.Row()


Patrick Molloy
Microsoft Excel MVP


Thanks Patrick,
I have tried to change, this time the error appears follow:
WITH Workbooks("convert").Sheets("CNV")

with the same description "Subscript out of range".
I also change it to
MyRow = Worksheets("CNV").Cells(65536,1).End(xlUp).Row()

and it works well. But this way is useful when I work in currently
workbook only and ofcourse I could not reference to worksheets in
another workbook. Sounds it needs some lib, but I do not know yet.
 
Back
Top