+ Reply to Thread
Results 1 to 3 of 3

Trouble with assigning a Click Action to a dynamically created Chart

  1. #1
    Registered User
    Join Date
    07-09-2015
    Location
    Japan
    MS-Off Ver
    2013
    Posts
    2

    Trouble with assigning a Click Action to a dynamically created Chart

    Hi all,

    I have the following problem.

    I have a fully dynamic VBA generated Spreadsheet.
    It import raw data, sort them into Pivot Table then generate Graph in a newly generated Sheet.
    Now here is my problem, I need to add a click action for when I click on a chart, the spreadsheet automatically move to the proper tab.

    I tried to do it via Macro but while I get the code, if I change it, excel doesn't take my modification.
    I would like to keep button as a last solution as I don't want to pollute my graphs with extra object.

    By the way, is there any way to "fix" a chart to the Sheet so user can't move them accidentally? And obviously not impact on the function above?

    Thank you in advance.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Trouble with assigning a Click Action to a dynamically created Chart

    Can you post the code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-09-2015
    Location
    Japan
    MS-Off Ver
    2013
    Posts
    2

    Re: Trouble with assigning a Click Action to a dynamically created Chart

    Hi Norie,

    Sorry for the delay.
    I can't really speak of code right now but basically the following:
    ActiveSheet.ChartObjects("Chart1").Activate
    Selection.OnAction = "Book1!ThisWorkbook.unHideSR"

    I presume that when I create the Macro to record the action:
    - Select the Chart
    - Assign Macro to Chart
    Excel is effectively assigning the macro, so if click on the chart, the macro run and unhide the tab as wanted.
    But if I change the Macro assigned to the chart then original macro continue running.

    And as my code requires to link the Macro for the Charts dynamically, this is not going anywhere for me.
    Either Excel doesn't allow for this type of action or I'm looking at the wrong place.

    Regards

+ 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. Assigning macros to a dynamically created userform
    By moosemaster23 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-19-2013, 07:42 AM
  2. Add MouseMove action to dynamically created form controls
    By AdLoki in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-19-2013, 09:09 AM
  3. Click event of dynamically created label
    By ajaykgarg in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-03-2010, 10:09 AM
  4. On click, copy the corresponding row to a new dynamically created workbook
    By munzer1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2007, 07:40 PM
  5. Assign click functionality to dynamically created textboxes?
    By Ouka in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2005, 10:15 PM

Tags for this Thread

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