Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default List all comments in a workbook, by sheet and cell

Hello --

I had success with the code posted by

Patrick Molloy
Subject: Search comment with value
Date: 2002-08-01 11:56:07 PST

to list the comments in a sheet.

Does anyone know of or can you suggest how to embed this code in a loop
through all sheets in the workbook, so I can document the workbook with one
run of a process, rather than having to run the process for each sheet?

I want the new sheet to have the following columns:
Workbook name
Worksheet name
Cell reference
Comment

Thanks for any help.

Larry Mehl


Patrick's code:
Sub FindComments()
Dim cell As Range, rng As Range
Dim ws As Worksheet, rw As Long
On Error Resume Next
Set rng = ActiveSheet.Cells.SpecialCells(xlCellTypeComments)
If rng Is Nothing Then
MsgBox "No cells with comments were found."
Else
Set ws = Worksheets.Add
For Each cell In rng
rw = rw + 1
ws.Cells(rw, 1) = cell.Address
ws.Cells(rw, 2) = cell.Comment.Text
Next
End If
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default List all comments in a workbook, by sheet and cell

Try this:

Sub ListAllActiveWBComments()
Dim Cell As Range, Rng As Range
Dim WS As Worksheet, RW As Long
On Error Resume Next
Worksheets.Add
For Each WS In Worksheets
Set Rng = Nothing
Set Rng = WS.Cells.SpecialCells(xlCellTypeComments)
If Not Rng Is Nothing Then
For Each Cell In Rng
RW = RW + 1
Cells(RW, 1) = ActiveWorkbook.Name
Cells(RW, 2) = WS.Name
Cells(RW, 3) = Cell.Address
Cells(RW, 4) = Cell.Comment.Text
Next
End If
Next
End Sub


--
Jim Rech
Excel MVP
"L Mehl" wrote in message
...
| Hello --
|
| I had success with the code posted by
|
| Patrick Molloy
| Subject: Search comment with value
| Date: 2002-08-01 11:56:07 PST
|
| to list the comments in a sheet.
|
| Does anyone know of or can you suggest how to embed this code in a loop
| through all sheets in the workbook, so I can document the workbook with
one
| run of a process, rather than having to run the process for each sheet?
|
| I want the new sheet to have the following columns:
| Workbook name
| Worksheet name
| Cell reference
| Comment
|
| Thanks for any help.
|
| Larry Mehl
|
|
| Patrick's code:
| Sub FindComments()
| Dim cell As Range, rng As Range
| Dim ws As Worksheet, rw As Long
| On Error Resume Next
| Set rng = ActiveSheet.Cells.SpecialCells(xlCellTypeComments)
| If rng Is Nothing Then
| MsgBox "No cells with comments were found."
| Else
| Set ws = Worksheets.Add
| For Each cell In rng
| rw = rw + 1
| ws.Cells(rw, 1) = cell.Address
| ws.Cells(rw, 2) = cell.Comment.Text
| Next
| End If
| End Sub
|
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default List all comments in a workbook, by sheet and cell

Jim --

Thank you very much. Your code lists the information I want, and will save
a lot of time.

Now that you have done the heavy lifting, I will practice my coding skills
and see if I can name the new worksheet, specify width for column D, add
gridlines, and a custom footer.

Larry Mehl


"Jim Rech" wrote in message
...
Try this:

Sub ListAllActiveWBComments()
Dim Cell As Range, Rng As Range
Dim WS As Worksheet, RW As Long
On Error Resume Next
Worksheets.Add
For Each WS In Worksheets
Set Rng = Nothing
Set Rng = WS.Cells.SpecialCells(xlCellTypeComments)
If Not Rng Is Nothing Then
For Each Cell In Rng
RW = RW + 1
Cells(RW, 1) = ActiveWorkbook.Name
Cells(RW, 2) = WS.Name
Cells(RW, 3) = Cell.Address
Cells(RW, 4) = Cell.Comment.Text
Next
End If
Next
End Sub


--
Jim Rech
Excel MVP
"L Mehl" wrote in message
...
| Hello --
|
| I had success with the code posted by
|
| Patrick Molloy
| Subject: Search comment with value
| Date: 2002-08-01 11:56:07 PST
|
| to list the comments in a sheet.
|
| Does anyone know of or can you suggest how to embed this code in a loop
| through all sheets in the workbook, so I can document the workbook with
one
| run of a process, rather than having to run the process for each sheet?
|
| I want the new sheet to have the following columns:
| Workbook name
| Worksheet name
| Cell reference
| Comment
|
| Thanks for any help.
|
| Larry Mehl
|
|
| Patrick's code:
| Sub FindComments()
| Dim cell As Range, rng As Range
| Dim ws As Worksheet, rw As Long
| On Error Resume Next
| Set rng = ActiveSheet.Cells.SpecialCells(xlCellTypeComments)
| If rng Is Nothing Then
| MsgBox "No cells with comments were found."
| Else
| Set ws = Worksheets.Add
| For Each cell In rng
| rw = rw + 1
| ws.Cells(rw, 1) = cell.Address
| ws.Cells(rw, 2) = cell.Comment.Text
| Next
| End If
| End Sub
|
|




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
Creating a list from another sheet or workbook walrus Excel Discussion (Misc queries) 6 May 14th 10 09:31 AM
Delete all cell comments in workbook Gord Dibben Excel Discussion (Misc queries) 2 February 21st 10 05:37 PM
cell comments disappear in shared workbook Steve @ ACN Excel Worksheet Functions 0 August 21st 06 06:40 PM
Adding comments to unprotected cell in a protected sheet Dave Excel Discussion (Misc queries) 3 February 8th 06 10:59 PM


All times are GMT +1. The time now is 04:07 AM.

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

About Us

"It's about Microsoft Excel"