Results 1 to 6 of 6

Thread: [RESOLVED] Move Method Excel VBA

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Location
    Montreal, Canada
    Posts
    152

    Resolved [RESOLVED] Move Method Excel VBA

    I'm trying to move worksheet from workbook 1 to workbook 2 using a loop.

    The 12 first iterations work fine, at the thirdteen attempt I'm getting a Move Method of worksheet class failed.

    I'm in a loop, so if the 12 first work why not the other. Is there a limit of sheet that can be moved.

    So both workbook exist
    The sheet to be moved exist
    There is still a lot of memory available.
    And I'm not able to manually move the sheet too.
    But I can add a new sheet
    Excel 2003


    So what the F

    One keyboard down
    Last edited by billhuard; Mar 22nd, 2006 at 03:43 PM.

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Move Method Excel VBA

    Bill
    Make the loop start at the last worksheet and work backwards. If you go in a forward direction, you will skip sheets - you move sheet 1, the count goes to 2, so next time you end up moving sheet 3....

    VB Code:
    1. For x = ThisWorkbook.Worksheets.Count To 1 Step -1
    2.     'insert your code here
    3. Next x
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Location
    Montreal, Canada
    Posts
    152

    Re: Move Method Excel VBA

    alway better with code snippet

    I'm not using sheet number but sheet name sent to the sub


    ...
    Last edited by billhuard; Mar 23rd, 2006 at 08:41 AM.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Location
    Montreal, Canada
    Posts
    152

    Re: Move Method Excel VBA

    Like I said I'm not even manually able to move a sheet from workbook 1 to workbook 2.


    But I've opened a new workbbok, and I'm able to move a sheet from workbook 3 to workbook 2.


    Now I' really confused

    There is nothing to understand.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Location
    Montreal, Canada
    Posts
    152

    Re: Move Method Excel VBA

    tabarnak

    I closed workbook 1. Reopened it
    I've been able to move 5 more sheet.

    Now it is stuck. No more move from workbook 1 to workbook 2.
    But again I've been able to move 12 sheets from workbook 3 to workbook 2.
    I closed workbook 3, reopened it and I've been able to move 5 more sheets before being stuck.

    And guess what, I've open a 4th workbook. And the F.... same thing happen.
    But I'm still able to add new sheets

    Keyboard 2 is down

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Location
    Montreal, Canada
    Posts
    152

    Re: Move Method Excel VBA

    I didn't find out what the hell is going on.

    So this thread is solved. I'm gonna add a new sheet to the workbook 2 and copy paste the sheet from workbook 1.

    Saved the screen

Posting Permissions

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



Click Here to Expand Forum to Full Width