Macro to get comments from a range of cells

im4floridagtrz

New Member
Joined
Apr 12, 2011
Messages
4
All,

I am looking for a code that will take comments from multiple cells within a row and return the product into one cell in a difrrent worksheet. I have tried everything with no luck. Can someone please help me out?

Thanks
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try like this

Code:
Sub cmts()
Dim cmt As Comment, msg As String
With Sheets("Sheet1")
    For Each cmt In .Comments
        msg = msg & vbNewLine & cmt.Parent.NoteText
    Next cmt
End With
Sheets("Sheet2").Range("A1").Value = msg
End Sub
 
Upvote 0
Thanks for the reply! That code sorta worked, it put all the cooments from the whole workbook into one cell. Let me explain further what I am looking for. I am looking to take all of the comments from E2:E309 and put them into cell H2 on a diffrent workbook. I need comments from F2:F309 to go into H3, and so on.

Thanks
 
Upvote 0
Try like this

Code:
Sub cmts()
Dim c As Range
For Each c In Sheets("Sheet1").Range("E2:E309")
    If Not c.Comment Is Nothing Then Sheets("Sheet2").Range("H" & Rows.Count).End(xlUp).Offset(1).Value = c.NoteText
Next c
End Sub
 
Upvote 0
Thanks that works except for it only runs on column "E". What command will make it automatically go to "F" and so on? Or do I have to copy and paste for every row I want?
 
Upvote 0
Try

Rich (BB code):
Sub cmts()
Dim c As Range
For Each c In Sheets("Sheet1").Range("E2:F309")
    If Not c.Comment Is Nothing Then Sheets("Sheet2").Range("H" & Rows.Count).End(xlUp).Offset(1).Value = c.NoteText
Next c
End Sub

Change F to the rightmost column that you want to look at.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

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