+ Reply to Thread
Results 1 to 4 of 4

Moving sheets

  1. #1
    affordsol
    Guest

    Moving sheets

    Hi to all of you !

    -Running Windows2k pro and Excel97

    I work with two workbooks : srcWbk and destWbk.

    And I want to MOVE several worksheets from SourceWorkbook
    to DestinationWorkbook,
    ===> the condition being the sheet name end with " P1" (ex 'Sheet1 P1').

    The routine must check:
    if srcSheet exists in destwbk, must be deleted before the move.

    After the move, destwbk must be closed and control is back to srcwbk

    I have tried several codes which all work fine ...

    ....... BUT ....

    As soon as I implement the code into my real workbook
    (which has several modules and numerous worksheets),
    the real workbook STOPS working (vba ends) as soon as the destWbk is opened :
    Screen shows destwbk
    srcWbk is still opened but not active

    I have had exchanges with GS : see thread "Handling 2 workbooks"

    I have tried his code which works on samples but stops the same way in the
    real workbook.


    Does anyone have an idea about this strange phenomenon ???


    Thanks a lot to all of you and best regards from Belgium,
    Hervé+

  2. #2
    Tom Ogilvy
    Guest

    RE: Moving sheets

    Are you running the macro with a shortcut key that Includes Shift. If so,
    change the shortcut key not to include Shift.

    --
    Regards,
    Tom Ogilvy



    "affordsol" wrote:

    > Hi to all of you !
    >
    > -Running Windows2k pro and Excel97
    >
    > I work with two workbooks : srcWbk and destWbk.
    >
    > And I want to MOVE several worksheets from SourceWorkbook
    > to DestinationWorkbook,
    > ===> the condition being the sheet name end with " P1" (ex 'Sheet1 P1').
    >
    > The routine must check:
    > if srcSheet exists in destwbk, must be deleted before the move.
    >
    > After the move, destwbk must be closed and control is back to srcwbk
    >
    > I have tried several codes which all work fine ...
    >
    > ...... BUT ....
    >
    > As soon as I implement the code into my real workbook
    > (which has several modules and numerous worksheets),
    > the real workbook STOPS working (vba ends) as soon as the destWbk is opened :
    > Screen shows destwbk
    > srcWbk is still opened but not active
    >
    > I have had exchanges with GS : see thread "Handling 2 workbooks"
    >
    > I have tried his code which works on samples but stops the same way in the
    > real workbook.
    >
    >
    > Does anyone have an idea about this strange phenomenon ???
    >
    >
    > Thanks a lot to all of you and best regards from Belgium,
    > Hervé+


  3. #3
    affordsol
    Guest

    RE: Moving sheets

    Hi Tom,

    The macro is not called with a shortcut : it is a call with a menu command
    and the macro works perfectly on all build samples ...except on the real
    workbook !
    Regards,
    Hervé+

    "Tom Ogilvy" wrote:

    > Are you running the macro with a shortcut key that Includes Shift. If so,
    > change the shortcut key not to include Shift.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    >
    > "affordsol" wrote:
    >
    > > Hi to all of you !
    > >
    > > -Running Windows2k pro and Excel97
    > >
    > > I work with two workbooks : srcWbk and destWbk.
    > >
    > > And I want to MOVE several worksheets from SourceWorkbook
    > > to DestinationWorkbook,
    > > ===> the condition being the sheet name end with " P1" (ex 'Sheet1 P1').
    > >
    > > The routine must check:
    > > if srcSheet exists in destwbk, must be deleted before the move.
    > >
    > > After the move, destwbk must be closed and control is back to srcwbk
    > >
    > > I have tried several codes which all work fine ...
    > >
    > > ...... BUT ....
    > >
    > > As soon as I implement the code into my real workbook
    > > (which has several modules and numerous worksheets),
    > > the real workbook STOPS working (vba ends) as soon as the destWbk is opened :
    > > Screen shows destwbk
    > > srcWbk is still opened but not active
    > >
    > > I have had exchanges with GS : see thread "Handling 2 workbooks"
    > >
    > > I have tried his code which works on samples but stops the same way in the
    > > real workbook.
    > >
    > >
    > > Does anyone have an idea about this strange phenomenon ???
    > >
    > >
    > > Thanks a lot to all of you and best regards from Belgium,
    > > Hervé+


  4. #4
    affordsol
    Guest

    RE: Moving sheets

    Tom,
    I forgot to say : if you want, I can send you the whole workbook.

    regards from Belgium,
    Hervé+

    "affordsol" wrote:

    > Hi Tom,
    >
    > The macro is not called with a shortcut : it is a call with a menu command
    > and the macro works perfectly on all build samples ...except on the real
    > workbook !
    > Regards,
    > Hervé+
    >
    > "Tom Ogilvy" wrote:
    >
    > > Are you running the macro with a shortcut key that Includes Shift. If so,
    > > change the shortcut key not to include Shift.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > >
    > > "affordsol" wrote:
    > >
    > > > Hi to all of you !
    > > >
    > > > -Running Windows2k pro and Excel97
    > > >
    > > > I work with two workbooks : srcWbk and destWbk.
    > > >
    > > > And I want to MOVE several worksheets from SourceWorkbook
    > > > to DestinationWorkbook,
    > > > ===> the condition being the sheet name end with " P1" (ex 'Sheet1 P1').
    > > >
    > > > The routine must check:
    > > > if srcSheet exists in destwbk, must be deleted before the move.
    > > >
    > > > After the move, destwbk must be closed and control is back to srcwbk
    > > >
    > > > I have tried several codes which all work fine ...
    > > >
    > > > ...... BUT ....
    > > >
    > > > As soon as I implement the code into my real workbook
    > > > (which has several modules and numerous worksheets),
    > > > the real workbook STOPS working (vba ends) as soon as the destWbk is opened :
    > > > Screen shows destwbk
    > > > srcWbk is still opened but not active
    > > >
    > > > I have had exchanges with GS : see thread "Handling 2 workbooks"
    > > >
    > > > I have tried his code which works on samples but stops the same way in the
    > > > real workbook.
    > > >
    > > >
    > > > Does anyone have an idea about this strange phenomenon ???
    > > >
    > > >
    > > > Thanks a lot to all of you and best regards from Belgium,
    > > > Hervé+


+ 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