ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test a cell for a comment presence from within a macro form 2007 (https://www.excelbanter.com/excel-programming/407678-test-cell-comment-presence-within-macro-form-2007-a.html)

Fritz

Test a cell for a comment presence from within a macro form 2007
 
I would like to completely control cell comments from a macro form. I am
unable to determine if a cell does not have a comment or does have one. How
do you relate the comment of each cell in a row of cells to its comment
object. Comment index numbers do not seem to carry any relationship with
them outside the object.

Peter T

Test a cell for a comment presence from within a macro form 2007
 
dim cell as Range
dim cmt as Comment

'' relate comment to cell

For each cell in Range("A1:J1")
If not cell.Comment Is nothing then
' it has a comment
Set cmt = cell.Comment ' if want to do more with the comment
debug.? cell.Address(),0)
debug.? cmt.Text
end if
next


relate cell to comment

For each cmt in Activesheet.comments
debug.? cmt.parent.Address(),0)
debug.? cmt.Text
Next

Regards
Peter T




"Fritz" wrote in message
...
I would like to completely control cell comments from a macro form. I am
unable to determine if a cell does not have a comment or does have one.

How
do you relate the comment of each cell in a row of cells to its comment
object. Comment index numbers do not seem to carry any relationship with
them outside the object.





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

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