View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Stonewall Rubberbow Stonewall Rubberbow is offline
external usenet poster
 
Posts: 12
Default COUNTIF to count cells that have an attached comment

Bob, thanks for the quick reply. I'm familiar with Excel, but not how to add
VBA, or what to do with the formula once it has been added. I tried to copy
your post, and paste it into the sheet's code window in Visual Basic, but I
don't know what to do next, or how this affects the worksheet. Can you walk
me through this a little bit?

"Bob Phillips" wrote:

No, you need VBA

Public Sub Test()
Dim cell As Range
Dim cnt As Long
Dim cmt As Comment
On Error Resume Next
For Each cell In Selection
Set cmt = Nothing
Set cmt = cell.Comment
If Not cmt Is Nothing Then
cnt = cnt + 1
End If
Next cell
MsgBox cnt
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Stonewall Rubberbow" wrote
in message ...
Can I use COUNTIF (or anything) to count the number of cells in a range

that
have a comment attached to the cell?