ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to copy cell contents to comment (https://www.excelbanter.com/excel-programming/424955-macro-copy-cell-contents-comment.html)

RichUE

Macro to copy cell contents to comment
 
I have a number of cells where I would like to copy the cell contents to a
(new) comment. I recorded a macro to do this, but it includes the specific
cell position. How can I refer to the current cell position?

Sub Cell_text_to_comment()
'
' Cell_text_to_comment Macro
' Copy cell text to comment Macro recorded 03/03/2009
'
' Keyboard Shortcut: Ctrl+Shift+C
'
Range("J83").AddComment
Range("J83").Comment.Visible = False
Range("J83").Comment.Text Text:="R Curtis:" & Chr(10) & "Diode BAV10"
Range("J83").Select
End Sub

I'm not a programmer, so please keep things simple.

--
Richard

Search the web and raise money for charity at www.everyclick.com

Gary''s Student

Macro to copy cell contents to comment
 
Let's use the active cell. This will copy its contents into a comment:

Sub Cell_text_to_comment()
With ActiveCell
.AddComment
.Comment.Visible = False
.Comment.Text Text:=.Value
End With
End Sub


--
Gary''s Student - gsnu200835


"RichUE" wrote:

I have a number of cells where I would like to copy the cell contents to a
(new) comment. I recorded a macro to do this, but it includes the specific
cell position. How can I refer to the current cell position?

Sub Cell_text_to_comment()
'
' Cell_text_to_comment Macro
' Copy cell text to comment Macro recorded 03/03/2009
'
' Keyboard Shortcut: Ctrl+Shift+C
'
Range("J83").AddComment
Range("J83").Comment.Visible = False
Range("J83").Comment.Text Text:="R Curtis:" & Chr(10) & "Diode BAV10"
Range("J83").Select
End Sub

I'm not a programmer, so please keep things simple.

--
Richard

Search the web and raise money for charity at www.everyclick.com


RichUE

Macro to copy cell contents to comment
 
That's just what I need. Thanks!
--
Richard

Search the web and raise money for charity at www.everyclick.com


"Gary''s Student" wrote:

Let's use the active cell. This will copy its contents into a comment:

Sub Cell_text_to_comment()
With ActiveCell
.AddComment
.Comment.Visible = False
.Comment.Text Text:=.Value
End With
End Sub


--
Gary''s Student - gsnu200835


"RichUE" wrote:

I have a number of cells where I would like to copy the cell contents to a
(new) comment. I recorded a macro to do this, but it includes the specific
cell position. How can I refer to the current cell position?

Sub Cell_text_to_comment()
'
' Cell_text_to_comment Macro
' Copy cell text to comment Macro recorded 03/03/2009
'
' Keyboard Shortcut: Ctrl+Shift+C
'
Range("J83").AddComment
Range("J83").Comment.Visible = False
Range("J83").Comment.Text Text:="R Curtis:" & Chr(10) & "Diode BAV10"
Range("J83").Select
End Sub

I'm not a programmer, so please keep things simple.

--
Richard

Search the web and raise money for charity at www.everyclick.com



All times are GMT +1. The time now is 10:56 AM.

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