PDA

View Full Version : delete all comments



anandbohra
02-14-2008, 03:34 AM
Hi I want to delete all comments of each sheets from the activeworkbook

pl help me in completing this code.

Sub delete_comment()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ActiveWorkbook
Set ws = ActiveSheet
For Each ws In wb
ws.Cells.Comment.Delete
Next ws

End Sub

but its not going into loop or frankly to say not doing at all

pl help

xld
02-14-2008, 04:21 AM
Sub delete_comment()
Dim wb As Workbook
Dim ws As Worksheet
Dim cell As Range
Dim cmt As Comment

Set wb = ActiveWorkbook

On Error Resume Next
For Each ws In wb.Worksheets
For Each cell In ws.UsedRange.Cells

cell.Comment.Delete
Next cell
Next ws

End Sub