ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving a Comment into a Cell - automaticlly (https://www.excelbanter.com/excel-programming/397831-moving-comment-into-cell-automaticlly.html)

Mike P[_2_]

Moving a Comment into a Cell - automaticlly
 
Hello,

I have a spreadsheet with over 7000 rows. one of the rows, Column E,
periodically has comments attached to it. Can I write a VBA or Macro to
take the comments assigned to the cells in Column E and move them into a new
column as text. I wish to do this since I am exporting the file to text so I
may import it into Access, and I do not want to lose the info in the comment
field.

How to I copy the comment from E1 and place it in text in column F1. Then
automate this process to repeat for all 7000 rows.

Thank you in advance for your help.
Mike


Gary''s Student

Moving a Comment into a Cell - automaticlly
 
Sub comment_setter()
Dim r As Range, rr As Range
On Error Resume Next
Set r = Range("E:E").SpecialCells(xlCellTypeComments)
If r Is Nothing Then
MsgBox ("no comments found")
Exit Sub
End If

For Each rr In r
rr.Offset(0, 1).Value = rr.comment.Text
Next
End Sub
--
Gary''s Student - gsnu200745


"Mike P" wrote:

Hello,

I have a spreadsheet with over 7000 rows. one of the rows, Column E,
periodically has comments attached to it. Can I write a VBA or Macro to
take the comments assigned to the cells in Column E and move them into a new
column as text. I wish to do this since I am exporting the file to text so I
may import it into Access, and I do not want to lose the info in the comment
field.

How to I copy the comment from E1 and place it in text in column F1. Then
automate this process to repeat for all 7000 rows.

Thank you in advance for your help.
Mike


Mike P[_2_]

Moving a Comment into a Cell - automaticlly
 
This worked brilliantly! Thank You.

"Gary''s Student" wrote:

Sub comment_setter()
Dim r As Range, rr As Range
On Error Resume Next
Set r = Range("E:E").SpecialCells(xlCellTypeComments)
If r Is Nothing Then
MsgBox ("no comments found")
Exit Sub
End If

For Each rr In r
rr.Offset(0, 1).Value = rr.comment.Text
Next
End Sub
--
Gary''s Student - gsnu200745


"Mike P" wrote:

Hello,

I have a spreadsheet with over 7000 rows. one of the rows, Column E,
periodically has comments attached to it. Can I write a VBA or Macro to
take the comments assigned to the cells in Column E and move them into a new
column as text. I wish to do this since I am exporting the file to text so I
may import it into Access, and I do not want to lose the info in the comment
field.

How to I copy the comment from E1 and place it in text in column F1. Then
automate this process to repeat for all 7000 rows.

Thank you in advance for your help.
Mike



All times are GMT +1. The time now is 05:49 AM.

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