ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Discover the cell address of an attached comment? (https://www.excelbanter.com/excel-programming/418013-discover-cell-address-attached-comment.html)

MiD-AwE

Discover the cell address of an attached comment?
 
I am trying to read information from a comment and then get the address of
the cell the comment is attached to before writing the information into the
same cell in an other workbook. So for instance, If comment(1) in
workbook(a).worksheet(a) is @ range("I92") then I want to write comment(1)'s
string to workbook(b).worksheet(?).range("I92")

I've been attempting to use:

Workbooks("b").Worksheets("b").Activate
ActiveSheet.Range(CellComnt.Parent.Column & CellComnt.Parent.row).text =
Workbooks("a").Worksheets("a").Comments(1).Text

with no success. Please, I'm exasperated, can someone help? (I'm using Excel
2003)

Barb Reinhardt

Discover the cell address of an attached comment?
 
I got this to write the comments on worksheet 1 (the activesheet) to
worksheet 2.

Sub FindComments()
Dim CellCmnt As Comment

Dim aWS As Worksheet
Set aWS = ActiveSheet 'Which happens to be Worksheets(1)
Set oWS = Worksheets(2)

For Each CellCmnt In aWS.Comments
oWS.Range(CellCmnt.Parent.Address).Value = CellCmnt.text
Next CellCmnt

End Sub

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"MiD-AwE" wrote:

I am trying to read information from a comment and then get the address of
the cell the comment is attached to before writing the information into the
same cell in an other workbook. So for instance, If comment(1) in
workbook(a).worksheet(a) is @ range("I92") then I want to write comment(1)'s
string to workbook(b).worksheet(?).range("I92")

I've been attempting to use:

Workbooks("b").Worksheets("b").Activate
ActiveSheet.Range(CellComnt.Parent.Column & CellComnt.Parent.row).text =
Workbooks("a").Worksheets("a").Comments(1).Text

with no success. Please, I'm exasperated, can someone help? (I'm using Excel
2003)



All times are GMT +1. The time now is 08:19 AM.

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