+ Reply to Thread
Results 1 to 2 of 2

Macro - Delete Comments - What if there's none?

  1. #1
    Danny
    Guest

    Macro - Delete Comments - What if there's none?

    Hi,

    I inserted the Macro below into a series of macros. If there is(are) NO
    comment(s) in the worksheet, my macros will not run properly. Please edit my
    macro so if there is(are) NO comment(s), the rest of the macros will still
    run.

    Sub DeleteComments()
    Application.Goto Reference:="My_Range"
    Selection.SpecialCells(xlCellTypeComments).Select
    Selection.EntireRow.Delete
    End Sub

    Thank You.


  2. #2
    Chip Pearson
    Guest

    Re: Macro - Delete Comments - What if there's none?

    Danny,

    Try


    Sub DeleteComments()
    Application.Goto Reference:="My_Range"
    On Error Resume Next
    Selection.SpecialCells(xlCellTypeComments).Select
    If Err.Number = 0 Then
    Selection.EntireRow.Delete
    End If
    End Sub


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com

    "Danny" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I inserted the Macro below into a series of macros. If there
    > is(are) NO
    > comment(s) in the worksheet, my macros will not run properly.
    > Please edit my
    > macro so if there is(are) NO comment(s), the rest of the macros
    > will still
    > run.
    >
    > Sub DeleteComments()
    > Application.Goto Reference:="My_Range"
    > Selection.SpecialCells(xlCellTypeComments).Select
    > Selection.EntireRow.Delete
    > End Sub
    >
    > Thank You.
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1