Link to home
Start Free TrialLog in
Avatar of hermesalpha
hermesalphaFlag for Paraguay

asked on

For a cell in Excel overfilled with text that can't be displayed in full, what is the best way to display all text upon hovering with the mouse or selected with cursor?

For a cell in Excel overfilled with text that can't be displayed in full, what is the best way to display all text upon hovering with the mouse or selected with cursor?

For example, if I use Data/Data validation/Input message, is it possible to make this dynamic so that the message displayed is what the cell contains?

Or would I need to use VBA? For example if I could use VBA for getting each cell to autosize itself when the cell is selected or hovered over with the mouse pointer, would that be possible?

In other words, the cell's size is too small to display all the contents, and I want all contents in it to be displayed when the cell is selected with the cursor or hovered over with the mouse pointer.

I have Excel 2007.
Avatar of Doug
Doug
Flag of United States of America image

How many characters are in these cells? Would it be sufficient to resize the formula bar (drag the bottom edge down) or just to format the cells as wrap text?
ASKER CERTIFIED SOLUTION
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How about adding a comment to cells with long text?  That way, the mouse hover will show the text.
Here's an example of what I mean by widening the formula bar. It should work even for extraordinarily long text and it will always show the text in the current cell.  You do lose a little real estate out of the cell grid but if you're main interest is the text in the current cell then it probably doesn't matter.

User generated image
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hermesalpha

ASKER

Sorry for not replying until now. This looks great, will try it out in the weekend.
I tried below VBA code instead, and it worked fine except that the whole comment gets displayed on one single long row only. So the comment disappears in the right side of the screen.

Would it be possible to make some changes to this code below so the comment's width and height adjust automatically according to how close the selected cell is to the right margin of the screen and to the bottom margin of the screen (the closer to the right margin of the screen, the less the width would be; and the closer to the bottom margin of the screen, the less the height would be)?

This is the VBA code (which worked fine, except this detail that the comment gets displayed on a long single row only):

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Dim str As String
On Error Resume Next
str = Target.Value
Cells.ClearComments
If Target <> "" Then
   Target.AddComment str
   Target.Comment.Visible = True
   Target.Comment.Shape.TextFrame.AutoSize = True
   On Error Resume Next
If Target.Validation.Type <> 3 Then Exit Sub
On Error GoTo 0

With Target.Validation
     .InputMessage = Target.Value
End With
End If
End Sub
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Glad to be of assistance. Thanks for the feedback.