ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Move Method (https://www.excelbanter.com/excel-programming/347844-move-method.html)

Francis Brown

Move Method
 
corebook.Worksheets(SName).Move befo=newbook.Worksheets("Sheet1")

Can you explain why the above method fails with this error.

Run time error 1004

Move method of Worksheet class failed.

I am sure corebook and newbook are defined properly.
--
Regards and Thanks for any assistance.

Francis Brown.

Norman Jones

Move Method
 
Hi Francis,

Try:

Workbooks("Corebook.xls").Sheets(Sname).Move _
befo=Workbooks("NewBook.xls").Sheets("Sheet1")

---
Regards,
Norman


"Francis Brown" wrote in message
...
corebook.Worksheets(SName).Move befo=newbook.Worksheets("Sheet1")

Can you explain why the above method fails with this error.

Run time error 1004

Move method of Worksheet class failed.

I am sure corebook and newbook are defined properly.
--
Regards and Thanks for any assistance.

Francis Brown.




Francis Brown

Move Method
 
I cant use Newbook.xls as at this point in the procedure newbook is defined
from newbook = workbooks.add so i dont have a name for the workbook as yet.
--
Regards and Thanks for any assistance.

Francis Brown.


"Norman Jones" wrote:

Hi Francis,

Try:

Workbooks("Corebook.xls").Sheets(Sname).Move _
befo=Workbooks("NewBook.xls").Sheets("Sheet1")

---
Regards,
Norman


"Francis Brown" wrote in message
...
corebook.Worksheets(SName).Move befo=newbook.Worksheets("Sheet1")

Can you explain why the above method fails with this error.

Run time error 1004

Move method of Worksheet class failed.

I am sure corebook and newbook are defined properly.
--
Regards and Thanks for any assistance.

Francis Brown.





Norman Jones

Move Method
 
Hi Francis,

Try:

Dim WB As Workbook

Set WB = Workbooks.Add

Workbooks("Corebook.xls").Sheets(Sname).Move _
befo=WB.Sheets("Sheet1")


---
Regards,
Norman



"Francis Brown" wrote in message
...
I cant use Newbook.xls as at this point in the procedure newbook is defined
from newbook = workbooks.add so i dont have a name for the workbook as
yet.
--
Regards and Thanks for any assistance.

Francis Brown.


"Norman Jones" wrote:

Hi Francis,

Try:

Workbooks("Corebook.xls").Sheets(Sname).Move _
befo=Workbooks("NewBook.xls").Sheets("Sheet1")

---
Regards,
Norman


"Francis Brown" wrote in message
...
corebook.Worksheets(SName).Move befo=newbook.Worksheets("Sheet1")

Can you explain why the above method fails with this error.

Run time error 1004

Move method of Worksheet class failed.

I am sure corebook and newbook are defined properly.
--
Regards and Thanks for any assistance.

Francis Brown.







Bob Phillips[_6_]

Move Method
 
Then do something like

Set oWb = Workbooks.Add
Workbooks("Corebook.xls").Sheets(Sname).Move _
befo=oWb.Sheets("Sheet1")


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Francis Brown" wrote in message
...
I cant use Newbook.xls as at this point in the procedure newbook is

defined
from newbook = workbooks.add so i dont have a name for the workbook as

yet.
--
Regards and Thanks for any assistance.

Francis Brown.


"Norman Jones" wrote:

Hi Francis,

Try:

Workbooks("Corebook.xls").Sheets(Sname).Move _
befo=Workbooks("NewBook.xls").Sheets("Sheet1")

---
Regards,
Norman


"Francis Brown" wrote in

message
...
corebook.Worksheets(SName).Move befo=newbook.Worksheets("Sheet1")

Can you explain why the above method fails with this error.

Run time error 1004

Move method of Worksheet class failed.

I am sure corebook and newbook are defined properly.
--
Regards and Thanks for any assistance.

Francis Brown.







Francis Brown

Move Method
 
Hi All.

I think my original code all prety much coresponds in principal to yours.

I think the move command has a similar problem to the excel copy command.

I discovered by putting all the code in seperate procedure and calling from
the primary procedure allows it to run. However if you then run the procedure
a second time after adding new data it comes back to the original error.

This is why i think it must be similar to the copy command error that
happens if that command executes too many times.
--
Regards and Thanks for any assistance.

Francis Brown.


"Bob Phillips" wrote:

Then do something like

Set oWb = Workbooks.Add
Workbooks("Corebook.xls").Sheets(Sname).Move _
befo=oWb.Sheets("Sheet1")


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Francis Brown" wrote in message
...
I cant use Newbook.xls as at this point in the procedure newbook is

defined
from newbook = workbooks.add so i dont have a name for the workbook as

yet.
--
Regards and Thanks for any assistance.

Francis Brown.


"Norman Jones" wrote:

Hi Francis,

Try:

Workbooks("Corebook.xls").Sheets(Sname).Move _
befo=Workbooks("NewBook.xls").Sheets("Sheet1")

---
Regards,
Norman


"Francis Brown" wrote in

message
...
corebook.Worksheets(SName).Move befo=newbook.Worksheets("Sheet1")

Can you explain why the above method fails with this error.

Run time error 1004

Move method of Worksheet class failed.

I am sure corebook and newbook are defined properly.
--
Regards and Thanks for any assistance.

Francis Brown.








All times are GMT +1. The time now is 09:44 PM.

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