How can I programatically detect if there are any comments on a worksheet?
Geoff
How can I programatically detect if there are any comments on a worksheet?
Geoff
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
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
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
>
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks