Hello zoneblitz61,
This actually involves quite a few techniques to make it work. Fortunately, there are no hooks or API calls needed to make it work. You should refer to Sheet1 of the attached workbook to follow what I am saying.
The worksheet contains 2 named ranges: Initials and Names, one helper cell in E2 and a validation drop down list in cell G2 that displays Initials.
The helper cell has the following formula:
=INDEX(Names,MATCH(G2,Initials, 0))
This formula returns the name for the selected initials.
The next piece of the puzzle is the Worksheet_Change event macro. This will place the contents of the helper cell (name) into the comment text. If the validation doesn't contain a comment, the macro will create one.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$2" Then
Set Cmnt = Target.Comment
If Cmnt Is Nothing Then
Target.AddComment Text:=Cells(2, "E").Text
Else
With Cmnt
.Text Text:=ActiveSheet.Cells(2, "E").Text
End With
End If
End If
End Sub
Sincerely,
Leith Ross
Bookmarks