+ Reply to Thread
Results 1 to 6 of 6

Move Method

  1. #1
    Francis Brown
    Guest

    Move Method

    corebook.Worksheets(SName).Move before:=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. #2
    Norman Jones
    Guest

    Re: Move Method

    Hi Francis,

    Try:

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

    ---
    Regards,
    Norman


    "Francis Brown" <[email protected]> wrote in message
    news:[email protected]...
    > corebook.Worksheets(SName).Move before:=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. #3
    Francis Brown
    Guest

    Re: 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 _
    > before:=Workbooks("NewBook.xls").Sheets("Sheet1")
    >
    > ---
    > Regards,
    > Norman
    >
    >
    > "Francis Brown" <[email protected]> wrote in message
    > news:[email protected]...
    > > corebook.Worksheets(SName).Move before:=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. #4
    Norman Jones
    Guest

    Re: Move Method

    Hi Francis,

    Try:

    Dim WB As Workbook

    Set WB = Workbooks.Add

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


    ---
    Regards,
    Norman



    "Francis Brown" <[email protected]> wrote in message
    news:[email protected]...
    >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 _
    >> before:=Workbooks("NewBook.xls").Sheets("Sheet1")
    >>
    >> ---
    >> Regards,
    >> Norman
    >>
    >>
    >> "Francis Brown" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > corebook.Worksheets(SName).Move before:=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. #5
    Bob Phillips
    Guest

    Re: Move Method

    Then do something like

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


    --

    HTH

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


    "Francis Brown" <[email protected]> wrote in message
    news:[email protected]...
    > 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 _
    > > before:=Workbooks("NewBook.xls").Sheets("Sheet1")
    > >
    > > ---
    > > Regards,
    > > Norman
    > >
    > >
    > > "Francis Brown" <[email protected]> wrote in

    message
    > > news:[email protected]...
    > > > corebook.Worksheets(SName).Move before:=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. #6
    Francis Brown
    Guest

    Re: 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 _
    > before:=oWb.Sheets("Sheet1")
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Francis Brown" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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 _
    > > > before:=Workbooks("NewBook.xls").Sheets("Sheet1")
    > > >
    > > > ---
    > > > Regards,
    > > > Norman
    > > >
    > > >
    > > > "Francis Brown" <[email protected]> wrote in

    > message
    > > > news:[email protected]...
    > > > > corebook.Worksheets(SName).Move before:=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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1