Show TextBox 1 when mouse hover

Thelfer

New Member
Joined
Sep 4, 2007
Messages
48
Hello
Looking for a way to get a comment to appear when a cell (or a text within a cell) is hovered. My text comment needs to be flexible, so it's a TextBox 1 with a function in formula bar, lets say "=A1".

I want this "TextBox 1" to be hidden and visible only when hovered.

Glad for any reply
Thanks
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Well there is a roundabout way of doing it depending on the use of the sheet.

You could have a macro that copies the text of Cell A1 into a comment.
But that means that if the value in A1 is changed, the comment is not updated.
If A1 is very static, you could run the macro when opening the spreadsheet. But then again, I am assuming your cell A1 could change values more often.

If the changes come about because a user enters data somewhere on the spreadsheet, then youcan link the macro to the onChange event of the sheet. And so the comment would be updated for every change made on the spreadsheet.

To achieve that, open the module for the worksheet, by right clicking on the worksheet tab and selecting View Code.

the macro editor will open on the wworksheet module.

Paste the following code:
Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Range("D4").ClearComments
Range("D4").AddComment Text:=Range("A1").Text
End Sub
This will update the comment of Cell D4 everytime a change is made to the spreadsheet.

This can be refined if you know which changes can effect the value of A1.

But for demo purposes, or as a one off, this should work
 
Upvote 0
Well there is a roundabout way of doing it depending on the use of the sheet.

You could have a macro that copies the text of Cell A1 into a comment.
But that means that if the value in A1 is changed, the comment is not updated.
If A1 is very static, you could run the macro when opening the spreadsheet. But then again, I am assuming your cell A1 could change values more often.

If the changes come about because a user enters data somewhere on the spreadsheet, then youcan link the macro to the onChange event of the sheet. And so the comment would be updated for every change made on the spreadsheet.

To achieve that, open the module for the worksheet, by right clicking on the worksheet tab and selecting View Code.

the macro editor will open on the wworksheet module.

Paste the following code:
Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Range("D4").ClearComments
Range("D4").AddComment Text:=Range("A1").Text
End Sub
This will update the comment of Cell D4 everytime a change is made to the spreadsheet.

This can be refined if you know which changes can effect the value of A1.

But for demo purposes, or as a one off, this should work

Beautiful, it solve my problem.
On sheet 2, I added this code:

-----------------------------
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("sheet1").Range("D4").ClearComments
Sheets("sheet1").Range("D4").AddComment Text:=Sheets("sheet3").Range("A1").Text

End Sub
-----------------------------

Tried also to add "ThisWorkook." but it complained that variable was not defined or similar:
ThisWorkook.Sheets("sheet1").....

Thank you very much.
 
Upvote 0
ThisWorkook.Sheets("sheet1").....
Typo? ThisWorkBook

Tip: In the vba editor, don't type in the capital letters. Then if you go to the next line and the word isn't properly capitalised, you have made a spelling error. Same with your variables: when you declare them use one or more capitals, when you use them in the code, type them lowercase - they should then get capitalised automatically , else error...

But you don't need to add ThisWorkbook here, because that is the default anyway.
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,762
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top