PDA

View Full Version : all comments in activesheet



lior03
12-27-2007, 01:46 AM
hello
i wanted to see all comments address in the activesheet on a msgbox.i manage to get the first and the last .how can i see all?.does any one care to comment?

Dim i As Integer
i = ActiveSheet.Comments.Count
MsgBox ("comments number is: " & i) & Chr(13) _
& Chr(10) & "first in cell - " & ActiveSheet.Comments(1).Parent.Address & Chr(13) _
& Chr(10) & "last in cell - " & ActiveSheet.Comments(i).Parent.Address, vbInformation, "comments number & address:"


thanks

Bob Phillips
12-27-2007, 02:21 AM
Dim NumComments As Long
Dim i As Long
Dim msg As String

With ActiveSheet
NumComments = .Comments.Count
msg = "comments number is: " & NumComments & vbNewLine
For i = 1 To NumComments
msg = msg & i & "# - " & .Comments(i).Parent.Address & vbNewLine
Next i
End With

MsgBox msg, vbInformation, "comments number & address:"