+ Reply to Thread
Results 1 to 3 of 3

HELP! Macro FAILS when I copy the worksheet...

  1. #1
    Chris M
    Guest

    HELP! Macro FAILS when I copy the worksheet...

    I have a macro (does simple formatting) that I need to leave in the worksheet
    object (NOT in a module). Reason for this is that I'm anticipating users
    needing to copy the worksheet into another file/new file. I need the macro
    to continue to work within ANY copied worksheet, whether in the same original
    file or in a separate file, INDEPENDENT of the original worksheet/file or any
    other worksheet. The user will CLICK a BUTTON on the worksheet to run the
    macro.

    PROBLEM: though the macro is carried with the worksheet (which is good),
    the macro won't execute correctly, or at all (ie, the BUTTON no longer
    works). When the BUTTON is clicked, the program either tries to open the
    original file where the macro was built, or simply bombs out (error code of
    400).

    How do I ensure that when I click a "button" on the worksheet that the macro
    assigned to it will ALWAYS work no matter where/how many times the worksheet
    is copied?

    THANKS FOR ANY HELP!!!


    Chris M

  2. #2
    Tom Ogilvy
    Guest

    Re: HELP! Macro FAILS when I copy the worksheet...

    It sounds like you are using a button from the Forms Toolbar. Use a
    commandbutton from the control Toolbox Toolbar and put your code in the
    click event of the commandbutton (found in the sheet module).

    --

    regards,
    Tom Ogilvy


    "Chris M" <ChrisM@discussions.microsoft.com> wrote in message
    news:D6C55FFD-CF3B-45EE-AE91-24FE7FEC68F4@microsoft.com...
    > I have a macro (does simple formatting) that I need to leave in the

    worksheet
    > object (NOT in a module). Reason for this is that I'm anticipating users
    > needing to copy the worksheet into another file/new file. I need the

    macro
    > to continue to work within ANY copied worksheet, whether in the same

    original
    > file or in a separate file, INDEPENDENT of the original worksheet/file or

    any
    > other worksheet. The user will CLICK a BUTTON on the worksheet to run the
    > macro.
    >
    > PROBLEM: though the macro is carried with the worksheet (which is good),
    > the macro won't execute correctly, or at all (ie, the BUTTON no longer
    > works). When the BUTTON is clicked, the program either tries to open the
    > original file where the macro was built, or simply bombs out (error code

    of
    > 400).
    >
    > How do I ensure that when I click a "button" on the worksheet that the

    macro
    > assigned to it will ALWAYS work no matter where/how many times the

    worksheet
    > is copied?
    >
    > THANKS FOR ANY HELP!!!
    >
    >
    > Chris M




  3. #3
    Chris M
    Guest

    Re: HELP! Macro FAILS when I copy the worksheet...

    Thanks Tom. Worked perfectly!
    --
    Chris M


    "Tom Ogilvy" wrote:

    > It sounds like you are using a button from the Forms Toolbar. Use a
    > commandbutton from the control Toolbox Toolbar and put your code in the
    > click event of the commandbutton (found in the sheet module).
    >
    > --
    >
    > regards,
    > Tom Ogilvy
    >
    >
    > "Chris M" <ChrisM@discussions.microsoft.com> wrote in message
    > news:D6C55FFD-CF3B-45EE-AE91-24FE7FEC68F4@microsoft.com...
    > > I have a macro (does simple formatting) that I need to leave in the

    > worksheet
    > > object (NOT in a module). Reason for this is that I'm anticipating users
    > > needing to copy the worksheet into another file/new file. I need the

    > macro
    > > to continue to work within ANY copied worksheet, whether in the same

    > original
    > > file or in a separate file, INDEPENDENT of the original worksheet/file or

    > any
    > > other worksheet. The user will CLICK a BUTTON on the worksheet to run the
    > > macro.
    > >
    > > PROBLEM: though the macro is carried with the worksheet (which is good),
    > > the macro won't execute correctly, or at all (ie, the BUTTON no longer
    > > works). When the BUTTON is clicked, the program either tries to open the
    > > original file where the macro was built, or simply bombs out (error code

    > of
    > > 400).
    > >
    > > How do I ensure that when I click a "button" on the worksheet that the

    > macro
    > > assigned to it will ALWAYS work no matter where/how many times the

    > worksheet
    > > is copied?
    > >
    > > THANKS FOR ANY HELP!!!
    > >
    > >
    > > Chris M

    >
    >
    >


+ 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