ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comment Field (https://www.excelbanter.com/excel-programming/373219-comment-field.html)

kirkm[_6_]

Comment Field
 

Is is possible to programmicably access the
comments in a speadsheet ?

I wish to save them to a file and replace them
in a new sheet.

There is a unique number in one column which could be
an identifier.

Any help appreciated.

Thanks - Kirk

Norman Jones

Comment Field
 
Hi Kirk,

Try something like:

'=============
Public Sub ListComments()
Dim srcSH As Worksheet
Dim destSH As Worksheet
Dim destRng As Range
Dim CMT As Comment

Set srcSH = ThisWorkbook.Sheets("Sheet2") '<<==== CHANGE
Set destSH = Sheets.Add(after:=Sheets(Sheets.Count))
Set destRng = destSH.Range("A1")

For Each CMT In srcSH.Comments
With CMT
destRng.Value = srcSH.Name
destRng(1, 2).Value = .Parent.Address
destRng(1, 3).Value = .Text
End With
Set destRng = destRng(2)
Next CMT
End Sub
'<<=============

---
Regards,
Norman



"kirkm" wrote in message
...

Is is possible to programmicably access the
comments in a speadsheet ?

I wish to save them to a file and replace them
in a new sheet.

There is a unique number in one column which could be
an identifier.

Any help appreciated.

Thanks - Kirk




kirkm[_6_]

Comment Field
 
On Tue, 19 Sep 2006 10:30:52 +0100, "Norman Jones"
wrote:


That's great Norman.

Thank you very much.

Cheers - Kirk


All times are GMT +1. The time now is 10:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com