moving comment data into cells

Praedico

New Member
Joined
Jul 17, 2008
Messages
43
I have an Excel 2003 spreadsheet on Win XP with a column of data. 635 rows plus the header. Some of the cells have comments, some don't.
I'd like to overwrite the data in the cell with the data in the comment (if the cell has one).
I don't really want to do this manually 635 times.
So far I have a macro with the following but it's not working:

Code:
Sub Macro1()
Dim r As Integer
Dim rmax as Integer
r = 2
rmax = 636
 
For r = 2 To rmax
If Sheet2.Range("a" & r).Comment.Text <> "" Then
Range("a" & r).Value = Range("g" & r).Comment.Text
End If
Next r
 
End Sub

I believe the issue is with the "comment.text" portion of the if statement and when it encounters a cell without a comment.

Any help is much appreciated
Thank you
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Maybe this:

Code:
Public Sub Test()

Dim oComment As Comment

For Each oComment In ActiveSheet.Comments
    ActiveSheet.Range(oComment.Parent.Address).Value = oComment.Text
Next oComment

End Sub
 
Upvote 0
Code:
Sub fff()

    Dim rng As Range
    
    For Each rng In Sheet2.Columns(1).SpecialCells(xlCellTypeComments)
        rng.Value = rng.Comment.Text
    Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top