ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying comments text to a cell using vba (https://www.excelbanter.com/excel-programming/351699-copying-comments-text-cell-using-vba.html)

TommoUK

Copying comments text to a cell using vba
 
Is it possible to copy the contents of a comments box to a cell on a
different sheet using VBA?

Norman Jones

Copying comments text to a cell using vba
 
Hi TommoUK,

Try something like:

'=============
Public Sub Tester001()
Dim SrcRng As Range
Dim destRng As Range
Dim cmt As Comment

Set SrcRng = ThisWorkbook.Sheets("Sheet1").Range("A1")
Set destRng = ThisWorkbook.Sheets("Sheet2").Range("B1")

Set cmt = SrcRng.Comment

destRng.Value = cmt.Text

Set cmt = Range("A1").Comment

End Sub
'<<=============


--
---
Regards,
Norman



"TommoUK" wrote in message
...
Is it possible to copy the contents of a comments box to a cell on a
different sheet using VBA?




Norman Jones

Copying comments text to a cell using vba
 
Hi TommoUK.

Please delete the extraneous final line:

Set cmt = Range("A1").Comment


---
Regards,
Norman


"Norman Jones" wrote in message
...
Hi TommoUK,

Try something like:

'=============
Public Sub Tester001()
Dim SrcRng As Range
Dim destRng As Range
Dim cmt As Comment

Set SrcRng = ThisWorkbook.Sheets("Sheet1").Range("A1")
Set destRng = ThisWorkbook.Sheets("Sheet2").Range("B1")

Set cmt = SrcRng.Comment

destRng.Value = cmt.Text

Set cmt = Range("A1").Comment

End Sub
'<<=============


--
---
Regards,
Norman





All times are GMT +1. The time now is 05:41 PM.

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