Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

detecting comments in cells

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
is there anyway to say if activecell contains a comment in it, then do whatever i want, thanks!
 
For just knowing that a cell contains a comment you may use:

Cells.SpecialCells(xlCellTypeComments).Activate

For returning the text in the comment - Thread68-519901 is good, indeed. I improved a little the solution making it to take in consideration the situation when the user has deleted the user name (like I almoust all the time do):

Function GetComment(ReferenceCell) As String
Dim cComment As Comment
Set cComment = ReferenceCell.Comment
If cComment Is Nothing Then
GetComment = "No comment"
Else
If Left(cComment.Text, Len(cComment.Author)) = cComment.Author Then
GetComment = Mid(cComment.Text, _
Len(cComment.Author) + 3, 999)
Else
GetComment = cComment.Text
End If
End If
Set cComment = Nothing
End Function

Sub test()
MsgBox GetComment(ActiveCell)
End Sub

I hope this helps,
Fane Duru'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top