#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please post this thread a correct full method, method about Nast Runsome New Users to Excel 8 February 25th 08 03:29 PM
Please post this thread a complete correct method, method about te Nast Runsome New Users to Excel 0 February 23rd 08 09:42 PM
"Move Method of Worksheet Class failed" azurmendi Excel Programming 4 November 3rd 05 02:59 PM
Why QUIT method doesn't work after COPY method? surotkin Excel Programming 3 October 26th 05 04:32 PM
VBA "move" method? bill_morgan_3333 Excel Programming 4 November 24th 04 11:59 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"