+ Reply to Thread
Results 1 to 3 of 3

Macro canīt be fired from another worksheet

  1. #1
    Registered User
    Join Date
    10-29-2010
    Location
    Netherlands
    MS-Off Ver
    Excel 2003
    Posts
    9

    Macro canīt be fired from another worksheet

    Hello,

    I've got the following macro in my workbook, and it works correct if started from the macro dialog box.
    Iīve assigned the macro to a button on another worksheet, but it fails to fire the macro.

    Am I right in assuming the macro needs editing (worksheet defining) in order to be fired from another worksheet?
    I haven't found any reference to this problem on the net.

    Please Login or Register  to view this content.
    Vincent
    Last edited by prop-er; 12-29-2011 at 05:15 AM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Macro canīt be fired from another worksheet

    There are a couple things you could do to improve this.
    1. Declare all your variables. For instance, iCol is not declared as anything so if you want it to be of a Long variable you should declare it as such. Hence, your Dim line should look something like:
    Please Login or Register  to view this content.
    2. Declare the worksheet like:
    Please Login or Register  to view this content.
    Your procedure could look something like:
    Please Login or Register  to view this content.
    Let me know how it goes.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    10-29-2010
    Location
    Netherlands
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Macro canīt be fired from another worksheet

    Hello Mordred,

    Thanks for your kind suggestions!
    It however didn't solve my problem.

    I created a new workbook to include with this reply to show the problem.
    Just then I realized I might include the function on the sheet, rather then in a module.

    This solved my problem, without changing the VBA function.
    It's so simple sometimes, it stares right at you.

    Thanks for the help.

    Vincent

+ 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