+ Reply to Thread
Results 1 to 4 of 4

Assign Private Sub Macro to Worksheet Shape

  1. #1
    Registered User
    Join Date
    01-24-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    60

    Assign Private Sub Macro to Worksheet Shape

    Hi Folks,

    not sure if this is meant to be obvious but in my worksheet code module lets say I have

    private macro1
    private macro2


    How do I assign these macros to the shapes on the actual worksheet - as they are private

    Please Login or Register  to view this content.

    thanks for your advice

    sl

  2. #2
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: Assign Private Sub Macro to Worksheet Shape

    under click event of the object use
    Run "Macro1"
    Kamboj
    _________________________________________________________________________________
    Mark the thread as SOLVED if my answer satisfy you.

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Assign Private Sub Macro to Worksheet Shape

    Try:
    Please Login or Register  to view this content.
    Where Sheet2 is the codename of the worksheet.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Registered User
    Join Date
    01-24-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    60

    Re: Assign Private Sub Macro to Worksheet Shape

    Smashing Folks,
    it worked!

    The small details matter

    Me.Shapes("Shape2").OnAction = "Sheet2.Macro1" and not the ! in front as I had

    I'll take a look at the click event too

    thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Assign a shape to macro excel 2007
    By keith915 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-13-2015, 08:24 AM
  2. [SOLVED] Assign Macro from another Workbook to Shape
    By nicotob in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-25-2014, 05:47 PM
  3. Assign macro with parameter to shape based on shape location
    By bobo3127 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2014, 11:18 AM
  4. [SOLVED] How to remove commands like cut, copy, assign macro or ... from shape context menu
    By hmaleki in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-15-2013, 04:10 AM
  5. macro to assign cell to shape
    By jw01 in forum Excel General
    Replies: 1
    Last Post: 07-25-2011, 02:36 PM
  6. Assign Macro to shapes and use shape.name to define action
    By globalpontoon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2011, 03:19 AM
  7. Assign Macro to shapes and use shape....text to define action
    By globalpontoon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-09-2011, 02:30 PM

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