Clearing Comments
Yes, both will remove all comments, but the first one also removes any other
values in the cell and then shifts cells upward in those columns. So, if you
only want to remove comments, the second one is probably what you should use.
You can specify any range of cells. Example:
For Each c In ActiveSheet.Range("A2:G40").Comments
'code to delete
Next
"kirkm" wrote:
On Sat, 21 Feb 2009 19:18:01 -0800, JLGWhiz
wrote:
To clear contents and comments:
Sub dk()
ActiveSheet.UsedRange. _
SpecialCells(xlCellTypeComments).Delete
End Sub
To clear comments only:
Sub sl()
Dim c As Comment
For Each c In ActiveSheet.Comments
If Not c Is Nothing Then
c.Delete
End If
Next
End Sub
I found that both routines c.Delete removes the comment
completely.
Cheers - Kirk
|