ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error when moving sheet (https://www.excelbanter.com/excel-programming/316188-error-when-moving-sheet.html)

mihai[_5_]

Error when moving sheet
 

Hi

I have this code for moving a sheet:

Workbooks.Open Filename:=a & "situatie_qsar.xls"
Workbooks.Open Filename:=a & "situatie_qsar_z.xls"
Sheets("situatie_qsar_z").Move
After:=Workbooks("situatie_qsar.xls").Sheets(1)

At the thired line I recive this error:
Run time error 9: Subscript out of range

Why?
The two files are exported from a program in "Microsoft Excel 2.1
Worksheet" format and I'm using Excel 2000.


--
mihai
------------------------------------------------------------------------
mihai's Profile: http://www.excelforum.com/member.php...fo&userid=2808
View this thread: http://www.excelforum.com/showthread...hreadid=276607


crispbd[_26_]

Error when moving sheet
 

Subscript out of range in this case probably means that the sheet
'situatie_qsar_z' doesn't exist.

mihai Wrote:
Hi

I have this code for moving a sheet:

Workbooks.Open Filename:=a & "situatie_qsar.xls"
Workbooks.Open Filename:=a & "situatie_qsar_z.xls"
Sheets("situatie_qsar_z").Move
After:=Workbooks("situatie_qsar.xls").Sheets(1)

At the thired line I recive this error:
Run time error 9: Subscript out of range

Why?
The two files are exported from a program in "Microsoft Excel 2.1
Worksheet" format and I'm using Excel 2000.



--
crispbd
------------------------------------------------------------------------
crispbd's Profile: http://www.excelforum.com/member.php...o&userid=10880
View this thread: http://www.excelforum.com/showthread...hreadid=276607


JulieD

Error when moving sheet
 
Hi

place the After line on the same line as the .Move command e.g.
Workbooks.Open Filename:=a & "situatie_qsar.xls"
Workbooks.Open Filename:=a & "situatie_qsar_z.xls"
Sheets("situatie_qsar_z").Move
After:=Workbooks("situatie_qsar.xls").Sheets(1)


Cheers
JulieD

"mihai" wrote in message
...

Hi

I have this code for moving a sheet:

Workbooks.Open Filename:=a & "situatie_qsar.xls"
Workbooks.Open Filename:=a & "situatie_qsar_z.xls"
Sheets("situatie_qsar_z").Move
After:=Workbooks("situatie_qsar.xls").Sheets(1)

At the thired line I recive this error:
Run time error 9: Subscript out of range

Why?
The two files are exported from a program in "Microsoft Excel 2.1
Worksheet" format and I'm using Excel 2000.


--
mihai
------------------------------------------------------------------------
mihai's Profile:
http://www.excelforum.com/member.php...fo&userid=2808
View this thread: http://www.excelforum.com/showthread...hreadid=276607





All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com