+ Reply to Thread
Results 1 to 8 of 8

adding a hover comment to a cell populated by text from another cell

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    539

    adding a hover comment to a cell populated by text from another cell

    Is there a way to have two worksheets in a workbook and have a cell in one worksheet display a comment based on the content of a cell from the other worksheet when you hover you mouse on top of the cell?

    cell a1 displays yes as text on worksheet 1.
    cell b1 displays is the sky blue as text but when you hover your mouse on top of it yes is displayed as a comment.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: adding a hover comment to a cell populated by text from another cell

    That is called a ScreenTip, and you can make it reference a any range with VBA
    This will show whatever is in sheet2A1 in the screen tip.
    Sub Button1_Click()
        Dim sh As Worksheet, ws As Worksheet
        Set sh = Sheets("Sheet1")
        Set ws = Sheets("Sheet2")
    
        With sh
    
            .Range("A3").Hyperlinks.Add Anchor:=.Range("A3"), Address:="", SubAddress:= _
                                        "Sheet2!A1", ScreenTip:=ws.Range("A1").Value, TextToDisplay:="Howdy!"
        End With
    End Sub

  3. #3
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    539

    Re: adding a hover comment to a cell populated by text from another cell

    this really isn't what I am needing. it is almost like a v lookup because not every cell will show the same thing.
    cell b1 on worksheet 2 will display what is in the cell a1 from worksheet 1
    cell b2 on worksheet 2 will display what is in the cell a2 from worksheet 2

    but instead of just looking for and then copying the data from one sheet to the next it should not be shown unless the mouse hovers over the cell.

    the reason I am trying to do this is because of conditional formatting. I am using a v lookup to populate the cells on sheet 2 with either a 1 or a 2 from sheet 1 and then display a green cell if 1 and a red cell if 2. I need to also be able to hover over or click on the cell and show a persons name based on a cell from worksheet 1

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: adding a hover comment to a cell populated by text from another cell

    AH, I was going to work on comments for you at first, then you said the text was blue, so thought you were referring to hyperlinks.

    Supply a sample workbook, you can use Vlookup or find in vba and put the results in a comment.

  5. #5
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    539

    Re: adding a hover comment to a cell populated by text from another cell

    here you go. the green squares on the log worksheet should say the names from the data sheet when you hover over them.
    Attached Files Attached Files

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: adding a hover comment to a cell populated by text from another cell

    I think i have it, let me know,

    Sub Add_Comments()
        Dim rng As Range, c As Range, s
        Dim sh As Worksheet
        Set sh = Sheets("Full Tracker Log")
        With sh
        Set rng = .Range("C6:AG" & .Cells(.Rows.Count, "A").End(xlUp).Row)
        For Each c In rng.Cells
            s = Application.VLookup(c.Offset(, 31), Sheets("Data").Range("A1:D100"), 4, False)
            If Not IsError(s) Then
                With c
                    .ClearComments
                    .AddComment
                    With .Comment
                        .Visible = False
                        .Text Text:=s
                        .Shape.Height = 15
                    End With
                End With
            End If
        Next c
        End With
    End Sub
    Last edited by davesexcel; 12-17-2018 at 04:08 PM.

  7. #7
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    539

    Re: adding a hover comment to a cell populated by text from another cell

    where do I put it?

  8. #8
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: adding a hover comment to a cell populated by text from another cell

    It's VBA code, put it in a module like you have in your previous posts, then run it.

+ 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. Best way to display text from another field in spreasheet as a comment on hover
    By jancliff in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-07-2018, 12:40 PM
  2. Replies: 20
    Last Post: 09-11-2018, 02:22 PM
  3. Replies: 11
    Last Post: 01-23-2017, 11:40 AM
  4. [SOLVED] Adding an e-mail address to an already populated cell
    By bralew in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-13-2016, 10:25 AM
  5. [SOLVED] Delete Comment once cell has been populated
    By coach.32 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2014, 07:05 PM
  6. Excel 2007 Cell Comment Hover Default Issue?
    By superboiler in forum Excel General
    Replies: 0
    Last Post: 05-22-2012, 08:52 AM
  7. Hover over text from another cell
    By pritchaj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2012, 03:43 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