Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sue Sue is offline
external usenet poster
 
Posts: 285
Default Returning the number of comments in a workbook

I've figured out how to do it in a Word document, but the object model or
something must be different for Excel (2003).

How can I have a msgbox pop up and tell me how many comments are in a
workbook?

thank you!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Returning the number of comments in a workbook

try something like

Sub test()
Dim lCommentCount As Long
Dim sht As Worksheet

For Each sht In ActiveWorkbook.Worksheets
lCommentCount = lCommentCount + sht.Comments.Count
Next sht
MsgBox lCommentCount & " total comments in the active workbook"
End Sub


--
Hope that helps.

Vergel Adriano


"Sue" wrote:

I've figured out how to do it in a Word document, but the object model or
something must be different for Excel (2003).

How can I have a msgbox pop up and tell me how many comments are in a
workbook?

thank you!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Returning the number of comments in a workbook

In a worksheet:

MsgBox Cells.SpecialCells(xlCellTypeComments).Count


In a multi-sheet workbook:

Dim myComment As Integer
Dim mySht As Worksheet
On Error Resume Next
For Each mySht In Worksheets
myComment = myComment + mySht.Cells.SpecialCells(xlCellTypeComments).Count
Next mySht

MsgBox myComment

HTH,
Bernie
MS Excel MVP


"Sue" wrote in message
...
I've figured out how to do it in a Word document, but the object model or
something must be different for Excel (2003).

How can I have a msgbox pop up and tell me how many comments are in a
workbook?

thank you!



  #4   Report Post  
Posted to microsoft.public.excel.programming
Sue Sue is offline
external usenet poster
 
Posts: 285
Default Returning the number of comments in a workbook

Excellent! thank you!!!

"Vergel Adriano" wrote:

try something like

Sub test()
Dim lCommentCount As Long
Dim sht As Worksheet

For Each sht In ActiveWorkbook.Worksheets
lCommentCount = lCommentCount + sht.Comments.Count
Next sht
MsgBox lCommentCount & " total comments in the active workbook"
End Sub


--
Hope that helps.

Vergel Adriano


"Sue" wrote:

I've figured out how to do it in a Word document, but the object model or
something must be different for Excel (2003).

How can I have a msgbox pop up and tell me how many comments are in a
workbook?

thank you!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Returning the number of comments in a workbook

sub ABC()
Dim sh as worksheet
Dim cnt as Long
for each sh in Worksheets
cnt = sh.Comments.count + cnt
Next
msgbox "Comment count is " & cnt
End Sub

--
Regards,
Tom Ogilvy



"Sue" wrote:

I've figured out how to do it in a Word document, but the object model or
something must be different for Excel (2003).

How can I have a msgbox pop up and tell me how many comments are in a
workbook?

thank you!



  #6   Report Post  
Posted to microsoft.public.excel.programming
Sue Sue is offline
external usenet poster
 
Posts: 285
Default Returning the number of comments in a workbook

Thank you Bernie, this is very helpful

"Bernie Deitrick" wrote:

In a worksheet:

MsgBox Cells.SpecialCells(xlCellTypeComments).Count


In a multi-sheet workbook:

Dim myComment As Integer
Dim mySht As Worksheet
On Error Resume Next
For Each mySht In Worksheets
myComment = myComment + mySht.Cells.SpecialCells(xlCellTypeComments).Count
Next mySht

MsgBox myComment

HTH,
Bernie
MS Excel MVP


"Sue" wrote in message
...
I've figured out how to do it in a Word document, but the object model or
something must be different for Excel (2003).

How can I have a msgbox pop up and tell me how many comments are in a
workbook?

thank you!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning a column name or number Frank[_4_] Excel Worksheet Functions 5 July 1st 07 05:58 AM
Finding value and returning row number merritts[_12_] Excel Programming 2 July 25th 06 03:26 AM
Returning value next to the nth occurrence of a particular number. daikontim Excel Worksheet Functions 4 February 21st 06 12:38 PM
returning workbook name Saladin Excel Programming 4 April 1st 05 08:10 AM
returning max UsedRange row number drabbacs Excel Programming 4 February 16th 04 07:59 PM


All times are GMT +1. The time now is 06:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"