comments

  • Thread starter Thread starter Rod Taylor
  • Start date Start date
R

Rod Taylor

I have a sub that will place a comment in the cell if the info is more then
a certain number of charters.
However I have two problems with this.
first if I protect the sheet with userinterface only then it won't put in
the comment
I got around this by unprotect the sheet but wondering if there might be
another way.

My new problem is if the sub to place a comment is called and the cell
already has a comment there then the program hangs

If I new that there was already a comment there then I found out how to turn
this into a variable and then place both in the cell as a comment.
so How do I find out if a cell currently has a comment or is there a better
way to do this

Thanks in advance
ROD
 
Checking for content is similar to putting in content.

If rngCells.Areas(1).Cells(lCnt).Comment Is Nothing Then
'no comment, so add one
rngCells.Areas(1).Cells(lCnt).AddComment _
rngComments.Areas(1).Cells(lCnt).Text
Else
'already comment, so delete then add
rngCells.Areas(1).Cells(lCnt).Comment.Delete
rngCells.Areas(1).Cells(lCnt).AddComment _
rngComments.Areas(1).Cells(lCnt).Text
End If

More information in
Cell Comments
http://www.mvps.org/dmcritchie/excel/ccomment.htm
 
Back
Top