Home » excel » vba – Tooltip of cell contents excel

vba – Tooltip of cell contents excel

Posted by: admin May 14, 2020 Leave a comment


I’m looking to find out how can i display a tooltip automatically in my tab “Sheet1”, column “C9:10000”, of all the cells that contain text (are not empty).

The purpose of this is to browse through that column of cells and when they are active OR mouse over cell a tooltip would appear in a “baloon” type to display the entire text.


How to&Answers:

You could borrow the InputMessage of Data Validation:

Dim rng As Range

For Each rng In Range("B2:B10")
    With rng.Validation
        .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, _
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .InputMessage = rng.Text
        .ShowInput = True
        .ShowError = True
    End With
Next rng

(empty cells will be ignored)

You have to click in the cell though, and there is a limitation to the max. number of characters (I haven’t checked what this is yet. Added: 254 characters).

Use Left(rng.Text, 254) in the above code as this is the maximum length in the InputMessage, and any more will cause an error.

BTW Most of the properties in the above code are likely to be optional – I borrowed this from a recorded macro.