Macro for excel to get all the comments to a new page


I want a macro which can search the page and get all the comments found in a sheet with the full line content to a new sheet.

LVL 11
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Do the comments have a specific identifier?

can u paste a sample of ur excel sheet
does it contain other"text" values ?
Chris BottomleySoftware Quality Lead EngineerCommented:
Full line content?

DO you want all the comment, (or all cell data) for a given row or d you mean all the comment text for a given cell comment

bsharathAuthor Commented:
No comments are of different data i it.

I have a excel which has 1000+ rows and 20 colums and every row has comments.Comments many vary from colum A,B,C etc.

bsharathAuthor Commented:

If i have a comment in Colum K in line 5.I need the full line 5 with the comment in a new sheet
Chris BottomleySoftware Quality Lead EngineerCommented:

For example try the following:

Sub ee_22713451_2()
Dim new_sheet As Worksheet
Dim sh As Worksheet
'Dim source_sheet As Worksheet
Dim new_sheet_name As String
Dim user_response As Integer
Dim cmt As Comment
Dim row_count As Long
Dim row_check As Long
row_count = 0
new_sheet_name = "Processed Data"

'Set source_sheet = ActiveSheet
For Each new_sheet In Worksheets
    If new_sheet.Name = new_sheet_name Then
        user_response = MsgBox("Target Sheet name: """ & new_sheet_name & """ Exists already.  Delete it and continue?", vbYesNo, "Delete and Continue?")
        If user_response = vbYes Then
            Application.DisplayAlerts = False
            Application.DisplayAlerts = True
            GoTo exiat1
        End If
    End If
    Set new_sheet = ThisWorkbook.Worksheets.Add
    new_sheet.Name = new_sheet_name
    For Each sh In ThisWorkbook.Worksheets
        row_check = 0
        For Each cmt In sh.Comments
            If row_check <> cmt.Parent.Row Then
                row_check = cmt.Parent.Row
                row_count = row_count + 1
                cmt.Parent.EntireRow.Copy new_sheet.Cells(row_count, 1)
            End If
End Sub


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.