+ Reply to Thread
Results 1 to 4 of 4

Counting Comments

  1. #1
    Geoff
    Guest

    Counting Comments

    How can I programatically detect if there are any comments on a worksheet?

    Geoff

  2. #2
    Peter T
    Guest

    Re: Counting Comments

    Sub test()
    Dim nComs As Long
    nComs = ActiveSheet.Comments.Count

    msgbox nComs

    End sub

    Regards,
    Peter T

    > How can I programatically detect if there are any comments on a worksheet?
    >
    > Geoff




  3. #3
    Gary''s Student
    Guest

    RE: Counting Comments

    Try this function:


    Function ccount(r As Range) As Integer
    Dim C As Comment
    Dim r1 As Range
    ccount = 0
    For Each r1 In r
    On Error Resume Next
    Set C = r1.Comment
    If Err.Number = 0 Then
    ccount = 1 + 1
    End If
    On Error GoTo 0
    Next
    End Function

    --
    Gary's Student


    "Geoff" wrote:

    > How can I programatically detect if there are any comments on a worksheet?
    >
    > Geoff


  4. #4
    Geoff
    Guest

    Re: Counting Comments

    Thanks for that.

    Geoff

    "Peter T" wrote:

    > Sub test()
    > Dim nComs As Long
    > nComs = ActiveSheet.Comments.Count
    >
    > msgbox nComs
    >
    > End sub
    >
    > Regards,
    > Peter T
    >
    > > How can I programatically detect if there are any comments on a worksheet?
    > >
    > > Geoff

    >
    >
    >


+ 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