+ Reply to Thread
Results 1 to 6 of 6

Calling a macro (on another sheet) using an image as a button

  1. #1
    Registered User
    Join Date
    01-23-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    58

    Calling a macro (on another sheet) using an image as a button

    I have a workbook with two worksheets. I have a macro on one of the worksheets which I want to call using a image as button which resides on the second sheet. When I wrote the macro there was just one sheet, I later added another sheet and put the image on it and assigned the macro to the image. However, when I click the image the macro runs on the sheet which contains the image. How can I make the macro run on the sheet that I want it to run??
    Thanks.

  2. #2
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: Calling a macro (on another sheet) using an image as a button

    Can you upload the file? You may need to modify the macro - to identify the activesheet you want the macro to function in. Depending on what the macro does that is...
    I help because of the Pavlovian dog that resides in the inner me...so if you are happy with the results, please add to my reputation. It helps keep me motivated!



    Please mark your threads as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Calling a macro (on another sheet) using an image as a button

    Post your code, remember to use Code tags
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    01-23-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: Calling a macro (on another sheet) using an image as a button

    Here is the code, it basically formats the sheet in a particular way - but I want to be able to call it from another sheet in the same workbook once the user pastes data into the macro workbook and clicks on the image (on the other sheet)

    I think I will need some kind of a code to specify which sheet the macro should target - but I dont know that that is -

    Can someone help??

    Thanks.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: Calling a macro (on another sheet) using an image as a button

    You can always insert the macro command

    Please Login or Register  to view this content.
    before the code that does the formating. That way you format that sheet - regardless of which sheet the macro is called from. Afterwards tho...

    Please Login or Register  to view this content.
    to put yourself back at the starting point from where you called the macro.

    Visually you will see a quick flip and the macro working...if you don't want that and just want it to work in the background - add:

    Please Login or Register  to view this content.
    at the start of the macro and

    Please Login or Register  to view this content.
    at the end.



    Hope that helps,

    GWB,

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Calling a macro (on another sheet) using an image as a button

    You don't usually need to select a sheet with code. How do you determine which sheet to run the code on? Your code currently runs on the active sheet.

+ 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