A
Alex
I have the following code that displays a comment when a cell is selected.
It also deletes the comment when another cell is selected (so that only the
selected cell has a comment showing). It works fine except that when a user
chooses an item from a drop-down list, all of the comments show. Is there a
way to revise my code so that comment don't show when a drop-down list item
is selected? Thank you much.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'*******************************************************
'Delete comments
Dim sh As Worksheet, cmt As Comment
For Each sh In ActiveWorkbook.Worksheets
For Each cmt In sh.Comments
cmt.Delete
Next
Next
'*******************************************************
'Add Comment
Dim myCell As Range
Dim myRng As Range
Set myRng = Me.Range("d2:d25")
If Intersect(Target, myRng) Is Nothing Then GoTo ProductFamily
For Each myCell In Intersect(Target, myRng).Cells
With myCell
.ClearComments 'remove old comment if there is one
.AddComment.Text Text:="Please enter a brief, yet descriptive title for
the voice entry."
.Comment.Visible = True
.Comment.Shape.TextFrame.AutoSize = True
End With
Next myCell
........ additional cell comments
It also deletes the comment when another cell is selected (so that only the
selected cell has a comment showing). It works fine except that when a user
chooses an item from a drop-down list, all of the comments show. Is there a
way to revise my code so that comment don't show when a drop-down list item
is selected? Thank you much.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'*******************************************************
'Delete comments
Dim sh As Worksheet, cmt As Comment
For Each sh In ActiveWorkbook.Worksheets
For Each cmt In sh.Comments
cmt.Delete
Next
Next
'*******************************************************
'Add Comment
Dim myCell As Range
Dim myRng As Range
Set myRng = Me.Range("d2:d25")
If Intersect(Target, myRng) Is Nothing Then GoTo ProductFamily
For Each myCell In Intersect(Target, myRng).Cells
With myCell
.ClearComments 'remove old comment if there is one
.AddComment.Text Text:="Please enter a brief, yet descriptive title for
the voice entry."
.Comment.Visible = True
.Comment.Shape.TextFrame.AutoSize = True
End With
Next myCell
........ additional cell comments