Excel Extract Cell Comments
Excel VBA/Macro example below will extract comment from every cells with comment, and put the summary in the cell selected by user using Excel input box (read more about how to get cell reference using input box here).
Sub CreateCommentsSummary()
Dim rgComments As Range, rgCell As Range, rgOutput As Range, iRow As Integer, iCol As Integer
' get all cells with comment
Set rgComments = ActiveSheet.Cells.SpecialCells(xlCellTypeComments)
' get cell reference where user want to place the summary
Set rgOutput = _
Application.InputBox(Prompt:="Select cell where you want to put the comments summary", _
Title:="Comments Summary", Type:=8)
iRow = rgOutput.Row
iCol = rgOutput.Column
' read each cell with comment and build the summary
For Each rgCell In rgComments
Cells(iRow, iCol) = rgCell.Address ' print cell address
Cells(iRow, iCol + 1) = rgCell.Value ' print cell value
Cells(iRow, iCol + 2) = rgCell.Comment.Text 'print cell comment text
iRow = iRow + 1
Next rgCell
End Sub
Happy coding
Related Entries
External Resources
- Microsoft Excel 2003/2007 Video Tutorials
Step-by-step video guide to mastering Charts, PivotTable, Data Analysis and Macro programming in Microsoft Excel in 5 hours.
- 101 Secrets of Microsoft Excel
Discover 101 of Excels little-known secrets that have been hiding right under your nose.
Tagged with: excel cell comment text, excel cell has comment, Excel Extract Comment Cell, excel print cell comment, get comments cell excel