How can I retrive the contents of a comment box in microsoft excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have inserted comments, and now i want to get the contents of each comment
in a cell. Is it possible?
 
Rg

The code below will take the comments from the active sheet and put them in
column A (Address) and column B (Text) on a new sheet inserted into the book

Sub ExtractCommentsToNewSheet()
Dim wksActive As Worksheet
Dim wksNew As Worksheet
Dim lCnt As Long
Dim rngComm As Range, myCell As Range
Set wksActive = ActiveSheet
Set wksNew = Worksheets.Add
Set rngComm = wksActive.Cells.SpecialCells(xlCellTypeComments)
lCnt = 1
For Each myCell In rngComm
With wksNew.Range("A" & lCnt)
.Value = myCell.Address
.Offset(0, 1).Value = myCell.Comment.Text
End With
lCnt = lCnt + 1
Next myCell
wksNew.Columns.AutoFit
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top