Consulting

Results 1 to 2 of 2

Thread: delete all comments

  1. #1
    VBAX Mentor anandbohra's Avatar
    Joined
    May 2007
    Location
    Mumbai
    Posts
    313
    Location

    delete all comments

    Hi I want to delete all comments of each sheets from the activeworkbook

    pl help me in completing this code.

    [VBA] 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
    [/VBA]
    but its not going into loop or frankly to say not doing at all

    pl help
    Always Mark your Thread as Solved the moment u got acceptable reply (located under Thread tools)
    Practice this & save time of others in thinking for unsolved thread

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    [vba]

    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •