Lockup on Comments - I Think

  • Thread starter Thread starter JAD
  • Start date Start date
J

JAD

I have a workbook in which I created (3) worksheets. In addition to formula's
and such, I have added a couple of comments to a couple of cells and then
copied, within the same worksheet, the comments to (49) identical tables.
Once I had the worksheet completed, I then copied it to (3) more worksheets.
The problem I am having is when I try to delete the comments, through the
Clear All command, sometimes it works without locking up the workbook and
other times it doesn't. Is their another way that I can delete all worksheet
comments to eliminate just one of the problems that may be locking up the
machine? Any help with the lockup problem and deleting of comments would be
appreciated. Thank You, JAD
 
You could try this code. It deletes on the active sheet only but could
easily be modified for the workbook.

Sub DeleteCommentsonActiveSheet()
Dim myComment As Comment
Dim Validate As VbMsgBoxResult
Dim myCount As Long

myCount = ActiveSheet.Comments.Count

If myCount = 0 Then
MsgBox ("There are no comments on the active sheet.")
Exit Sub

Else
Validate = MsgBox("You have " & myCount & " comment(s) on the active
sheet." & vbNewLine & _
"Do you want to delete?", vbYesNo)
If Validate = vbNo Then Exit Sub

End If

For Each myComment In ActiveSheet.Comments
myComment.Delete
Next myComment

End Sub
 
Back
Top