Cell mouseover action

joachym

New member
Joined
Mar 12, 2014
Messages
6
Reaction score
0
Points
0
Dear all,

I have read many artices about not being able to show a text when hovering over a certain cell.

On the other hand, this functionality exists directly in excel (see picture). Bez názvu.JPG

I only need to change the text in the box. Is there a way to do that?

Thank you very much.

Regards,
joachym
 
Range("A1").Comment.Text Text:="my new comment"
 
Dear patel,

Thank you for your reply. But I am affraid that it is not a comment.

I inserted the text using vba by entering the value in the adjacent cell and this "comment" appears itself when hovering over the cell - nevertheless, there is no red triangle in the cell corner and also the comment disappears after moving away so it cannot be changed. Moreover, it doesn't appear in 2010 only in 2003.
 
I'm using 2010, attach please a sample file with the code you used
 
Case 12 'if given cell (column) selected
If Cells(ActiveCell.Row, 1) <> "" Then 'if row record exists
If Target = "" Then
Target.Value = Cells(ActiveCell.Row, "M") - 1 'brings date from the adjacent cell lowered by one
Target.Interior.ColorIndex = 41 'changed color
'-------------------------------my attempts to show the weekday - this is my aim to show weekday when hovering over the cell-----------------------------------------
Select Case Weekday(Target.Value, 2)
Case 1
sText = "Monday"
Case 2
sText = "Tuesday"
Case 3
sText = "Wednesday"
Case 4
sText = "Thursday"
Case 5
sText = "Friday"
Case 6
sText = "Saturday"
Case 7
sText = "Sunday"
'End Select
Target.Validation.InputMessage = sText
'Target.AddComment sText
'Target.Comment.Shape.ScaleWidth 5.87, msoFalse, msoScaleFromTopLeft
'Target.Comment.Shape.ScaleHeight 2.26, msoFalse, msoScaleFromTopLeft
'-------------------------------------------------------------------------
Else 'if not empty change the color - this is not prety important
If Target.Interior.ColorIndex <> 41 Then
Target.Interior.ColorIndex = 41
Else
Target.Interior.ColorIndex = xlNone
End If
End If
End If

I really don't know where the popup box arises because it doesn't exist where the value input manually.

There is no easy way to create such popup message (wih "my" information so I wanted to know whether there is a way to use "automatic" popup.

Thanks again for your help!
 
I asked for xlsm file for testing
 
Sorry, attached now.

When you enter company name into B12, A12 is automatically filles as well as M12. After you click to L12 it will automatically insert date -1 into L12 - that's the moment of "comment" creation (not using my code). As I said, it doesn't appear in 2010!


Thanks
 
I need to post once more to be able to enter links....
 
Sorry, attached now.

When you enter company name into B12, A12 is automatically filles as well as M12. After you click to L12 it will automatically insert date -1 into L12 - that's the moment of "comment" creation (not using my code). As I said, it doesn't appear in 2010!

https://www.dropbox.com/s/p5p0gtc24oyt9to/Task.xlsm

Thanks
 
your code works on my excel 2010, i changed it to
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
On Error GoTo ErrHandler:

    Select Case Target.Column
        Case 2
            If Cells(ActiveCell.Row, 1) = "" Then
                Cells(ActiveCell.Row, 1) = Date
            End If
            If Cells(ActiveCell.Row, "M") = "" Then
                Cells(ActiveCell.Row, "M") = Date + 1.625
            End If
        Case 12
            If Cells(ActiveCell.Row, 1) <> "" Then
                If Target = "" Then
                    Target.Value = Cells(ActiveCell.Row, "M") - 1
                    Target.Interior.ColorIndex = 41
                    Select Case Weekday(Target.Value, 2)
                        Case 1
                            sText = "Monday"
                        Case 2
                            sText = "Tuesday"
                        Case 3
                            sText = "Wednesday"
                        Case 4
                            sText = "Thursday"
                        Case 5
                            sText = "Friday"
                        Case 6
                            sText = "Saturday"
                        Case 7
                            sText = "Sunday"
                    End Select
                    Target.AddComment sText
                Else
                    If Target.Interior.ColorIndex <> 41 Then
                        Target.Interior.ColorIndex = 41
                    Else
                        Target.Interior.ColorIndex = xlNone
                    End If
                End If
            End If
        Case 14
            If Cells(ActiveCell.Row, "M") <> "" And Target = "" Then
                Target.Value = Date + Time
                Cells(ActiveCell.Row, "L").Interior.ColorIndex = xlNone
            End If
        Case 15
            If Cells(ActiveCell.Row, "M") <> "" And Target = "" Then
                If Cells(ActiveCell.Row, "N") <> "" Then
                    Target.Value = Date
                Else
                    Cells(ActiveCell.Row, "N") = Date
                    Target.Value = Date
                End If
            End If
        Case 17
            If Cells(ActiveCell.Row, "O") <> "" And Target = "" Then
                Target.Value = Date
            End If
    End Select
    
ErrHandler:
    'If Err.Number = 9 Then
    'End If
End Sub
 
Back
Top