+ Reply to Thread
Results 1 to 6 of 6

Add Tooltip to Shape with Macro to include Text and cell value

  1. #1
    Registered User
    Join Date
    01-16-2023
    Location
    Adelaide,Australia
    MS-Off Ver
    365
    Posts
    6

    Add Tooltip to Shape with Macro to include Text and cell value

    Hi all,

    Hoping someone might be able to assist. I am a novice to macros and I'm not sure if what I want is possible. I found the below code to add a toolTip to a shape. Is it possible to expend on this to also include some cell values?

    For Example: My shape currently includes the tooltip (Mixing Pad) but I also want to include cell D2 value, possibly with D2 text

    So the tooltip would show

    Mixing Pad. Total 5

    Thanks


    Capture.JPG






    Please Login or Register  to view this content.
    Last edited by AliGW; 05-11-2023 at 02:44 AM. Reason: Code tags added.

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

    Re: Add Tooltip to Shape with Macro to include Text and cell value

    All you need to do is get rid of the InputBox and put the values from the cells in toolTipText.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    01-16-2023
    Location
    Adelaide,Australia
    MS-Off Ver
    365
    Posts
    6

    Re: Add Tooltip to Shape with Macro to include Text and cell value

    Thankyou -That worked perfectly.

    I noticed that the Tool Tip doesn't appear to be dynamic. I've updated the cell and it still has the original value - Is this expected?

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

    Re: Add Tooltip to Shape with Macro to include Text and cell value

    Yes it is unfortunately, the code doesn't link the tooltip to the cells, it only takes the values from the cells to set the text for the tooltip.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,917

    Re: Add Tooltip to Shape with Macro to include Text and cell value

    Administrative Note:

    @ADawn


    Please read the forum rules regarding code in your posts.

    Also, your forum profile should be showing [B]the version of Excel that you need this to work for[/B, not Windows.

    Members will tailor the solutions they offer to the version of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent versions of Excel are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the release number in your profile (e.g. MS365 Version 2211). This is in the About Excel section further down the Account page.

    Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Add Tooltip to Shape with Macro to include Text and cell value

    Hi all-
    You could update the tooltip via a User-Defined Function that takes a range as input. Just call it with D2 as input; Excel will re-calculate it whenever D2 changes.
    UDFs must be called from formulas; in the attached workbook, I just entered the following in cell D1 to ""calculate "" the Total column header...
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    ... and set UPDATE_TOOLTIP to return TRUE:
    Please Login or Register  to view this content.
    Note that this Function merely updates an EXISTING hyperlink; it does not ADD one. Also, as is true of most VBA code, whenever the UDF is triggered, you may not be able to UNDO previous actions.

    KEY POINTS to this approach:
    A) Write the function in a standard Module. The return type and value can be whatever the calling formula expects.
    B) Call the function from a formula, using the cell (or cells) you wish to track as parameter(s)
    Attached Files Attached Files
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

+ 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. Replies: 8
    Last Post: 08-06-2022, 07:29 PM
  2. [SOLVED] Add tip text into shape and assign also macro
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2020, 01:57 AM
  3. Replies: 5
    Last Post: 05-02-2014, 07:49 PM
  4. [SOLVED] Editing a Macro to include multiple rows and include text formatting for leading zeros
    By missmea2005 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-04-2014, 09:50 AM
  5. VBA to Get Tooltip text in Pivot Table
    By cyclone1980 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2014, 07:13 PM
  6. Change the tooltip text for a datapoint
    By Hayeso in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 12-16-2005, 09:35 AM
  7. [SOLVED] Tooltip text over a label
    By John Robinson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-27-2005, 04:06 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