+ Reply to Thread
Results 1 to 3 of 3

Delete Comment if contents = "HIDDEN FORMULA"

  1. #1
    achidsey
    Guest

    Delete Comment if contents = "HIDDEN FORMULA"

    Excel Experts,

    A spreadsheet I inherited is overrun with comments which say "HIDDEN
    FORMULA!" and I'd like to delete all of these comments. The spreadsheet has
    some useful comments so I don't want to delete every comment.

    When I used the macro recorder to figure out the Text of these comments, I
    got a line back

    Range("A1").Comment.Text Text:="HIDDEN FORMULA!" & Chr(10) & ""

    So I think my code should be something like,

    Dim C as Comment
    For Each C in ActiveSheet.Comments
    If Comment.Text = ""HIDDEN FORMULA!" & Chr(10) & """
    CellofComment.ClearComments
    End Sub

    I realize the "CellofComment" isn't the right way to reference the cell
    which contains the comment.

    Thanks in advance.

    Alan

    --
    achidsey

  2. #2
    Norman Jones
    Guest

    Re: Delete Comment if contents = "HIDDEN FORMULA"

    Hi Alan,

    Try:

    '==================>>
    Sub TesterA()
    Dim C As Comment
    For Each C In ActiveSheet.Comments
    If InStr(1, C.Text, _
    "HIDDEN FORMULA!", vbTextCompare) Then
    C.Delete
    End If
    Next C

    End Sub
    '<<==================

    ---
    Regards,
    Norman



    "achidsey" <chidsey2@hotmail.com(notmorespam)> wrote in message
    news:D23CD6BC-05D6-4513-B39F-3C15D9BD0046@microsoft.com...
    > Excel Experts,
    >
    > A spreadsheet I inherited is overrun with comments which say "HIDDEN
    > FORMULA!" and I'd like to delete all of these comments. The spreadsheet
    > has
    > some useful comments so I don't want to delete every comment.
    >
    > When I used the macro recorder to figure out the Text of these comments, I
    > got a line back
    >
    > Range("A1").Comment.Text Text:="HIDDEN FORMULA!" & Chr(10) & ""
    >
    > So I think my code should be something like,
    >
    > Dim C as Comment
    > For Each C in ActiveSheet.Comments
    > If Comment.Text = ""HIDDEN FORMULA!" & Chr(10) & """
    > CellofComment.ClearComments
    > End Sub
    >
    > I realize the "CellofComment" isn't the right way to reference the cell
    > which contains the comment.
    >
    > Thanks in advance.
    >
    > Alan
    >
    > --
    > achidsey




  3. #3
    achidsey
    Guest

    Re: Delete Comment if contents = "HIDDEN FORMULA"

    Norman,

    Worked perfectly.

    Thanks, Alan


    --
    achidsey


    "Norman Jones" wrote:

    > Hi Alan,
    >
    > Try:
    >
    > '==================>>
    > Sub TesterA()
    > Dim C As Comment
    > For Each C In ActiveSheet.Comments
    > If InStr(1, C.Text, _
    > "HIDDEN FORMULA!", vbTextCompare) Then
    > C.Delete
    > End If
    > Next C
    >
    > End Sub
    > '<<==================
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "achidsey" <chidsey2@hotmail.com(notmorespam)> wrote in message
    > news:D23CD6BC-05D6-4513-B39F-3C15D9BD0046@microsoft.com...
    > > Excel Experts,
    > >
    > > A spreadsheet I inherited is overrun with comments which say "HIDDEN
    > > FORMULA!" and I'd like to delete all of these comments. The spreadsheet
    > > has
    > > some useful comments so I don't want to delete every comment.
    > >
    > > When I used the macro recorder to figure out the Text of these comments, I
    > > got a line back
    > >
    > > Range("A1").Comment.Text Text:="HIDDEN FORMULA!" & Chr(10) & ""
    > >
    > > So I think my code should be something like,
    > >
    > > Dim C as Comment
    > > For Each C in ActiveSheet.Comments
    > > If Comment.Text = ""HIDDEN FORMULA!" & Chr(10) & """
    > > CellofComment.ClearComments
    > > End Sub
    > >
    > > I realize the "CellofComment" isn't the right way to reference the cell
    > > which contains the comment.
    > >
    > > Thanks in advance.
    > >
    > > Alan
    > >
    > > --
    > > achidsey

    >
    >
    >


+ 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