Creating Excel tooltips?

Solved
sucrette83 Posted messages 81 Status Member -  
pijaku Posted messages 13513 Registration date   Status Moderator Last intervention   -
Hello,

I mostly create protected spreadsheets. I want to create a tooltip that appears when hovering over cells, with a message like:
"WARNING! Only comments, the week number, and agencies can be modified."

I found a solution in a post that directed me to a website, but it doesn’t explain how to create and use the supposed VBA code.
Should I create a macro, a module, a userform???

Here’s the code in question given to me (by the way, if it doesn't match my request, please let me know...)

<STYLE>
a.info{
position:relative;
z-index:24; background-color:#ccc;
color:#000;
text-decoration:none}

a.info:hover{z-index:25; background-color:#ff0}

a.info span{display: none}

a.info:hover span{
/*the content of the span tag will
only be visible for the a:hover state */
display:block;
position:absolute;

top:2em; left:2em; width:15em;
border:1px solid #6699cc;
background-color:#eeeeee; color:#6699cc;
text-align: justify;
font-weight:none;
padding:1px;

}
</STYLE>

Biz Biz
Configuration: Windows 2003 Internet Explorer 8.0

6 answers

pijaku Posted messages 13513 Registration date   Status Moderator Last intervention   2 772
 
Hi,
Is this VBA?? Isn't it rather CSS?
--
Best regards,
-- What is worth doing is worth doing well --
0
sucrette83 Posted messages 81 Status Member 7
 
You just have to see how bad I am at programming lol. I don't even know what CSS means.
It's what we got in another post, "message on mouse hover," so were we not talking about the same thing... I don't know. It's not specified in the post.

How can I do for my own table?
0
pijaku Posted messages 13513 Registration date   Status Moderator Last intervention   2 772 > sucrette83 Posted messages 81 Status Member
 
On mouse over, I don't know, but it’s possible to display a message in a tooltip on click, depending on the content of the cell. In the example, if the cell is red, then "red cell" appears; otherwise, "not red" appears.
We can improve this, but we need to know more about your file. You can either attach it (don't forget to copy/paste the link obtained right here), or describe it to us.
--
Best regards,
-- What’s worth doing is worth doing well --
0
sucrette83 Posted messages 81 Status Member 7 > pijaku Posted messages 13513 Registration date   Status Moderator Last intervention  
 
Actually, it's simple. I want to create a shared table, but allow editing only in a few cells.

However, since there are very few cells accessible to everyone, and to avoid hearing "your table doesn't work," I would like a message to appear as soon as they hover (or click, I don't really care in the end) over a cell that cannot be edited.
0
pijaku Posted messages 13513 Registration date   Status Moderator Last intervention   2 772
 
Sorry for the wait...
I took the liberty of adapting the silkyroad code found here to your case and it gives:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim TargetMsg As String
Target.Validation.Delete
If Target.Locked = True Then
TargetMsg = "WARNING! Only comments, the week number, and agencies can be modified."
End If
With Target.Validation
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputMessage = TargetMsg
.ShowInput = True
.ShowError = True
End With
End Sub

It's not perfect but it has the merit of working.
To insert this code: right-click on the tab of the concerned sheet / view the code. A visual basic window opens, copy and paste this code into this window, close it, and try...
--
Best regards,
-- What is worth doing is worth doing well --
0
michel_m Posted messages 18903 Registration date   Status Contributor Last intervention   3 320
 
Hello,
at the request of Master Pijaku:

Sucrette, I feel like you’re overthinking it for not much!

1°/ VBA procedures often cause problems with shared workbooks

2°/ Why not unlock the cells where your colleagues can enter data and protect your workbook
3°/ To guide them, you could highlight those cells with a background color (light blue as it is not stressful) and frame them with a border, adding a small explanatory banner if needed. Here’s an example that I often use
https://www.cjoint.com/?jsqcGKdZC2

To implement this, it’s in the cell format and final protection panels: tools-protection (XL 2007)

For Pijaku:
We could use the mouse hover, but it’s a terrible hack: we create a transparent rectangle slightly larger than the cell and use an event like shape(1)_mousemove (I think), so when the X and Y match the position of the rectangle, you trigger the action.... so: it's a curiosity not to be used

--
Best regards, Michel
0
pijaku Posted messages 13513 Registration date   Status Moderator Last intervention   2 772
 
Thank you for stopping by...
--
Best regards,
-- What is worth doing is worth doing well --
0
sucrette83 Posted messages 81 Status Member 7
 
Sorry for the delay, but like in any business, I've been assigned to other urgent matters in the meantime...
Thanks to Pikaju and michel_m. In the end, I just locked my cells and hid my formulas, and wiped away the "your table doesn't work, we can't enter the total" (but well, you get used to it...)

Thank you very much, and I will apply your advice to my other Excel tables that I need to execute right now.

Kiss Kiss
0
excela
 
Hello,
I want to create a tooltip (containing a list of items) in a drop-down list in Excel, but for each item in my list.

Thank you for your potential future responses.
0
El Griingo Posted messages 1 Status Member
 
Up

I'm looking for the same thing as excela.

In a table containing the names of different clients, create a tooltip that shows detailed information about them, such as phone number, address, email, etc., when hovering over or clicking on the cell.

Thank you in advance!
0
pijaku Posted messages 13513 Registration date   Status Moderator Last intervention   2 772
 
Hello,
Excela wants a tooltip that changes based on a selection in a dropdown list = complicated process.

If you want to do the same thing, but without the dropdown list, check out the comments...
Right-click on the concerned cell / Insert a comment
0