Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Comment Cell Location (Excel 2003 VBA)

    I have the following code to run through all the commnets on a sheet.

    For Each c In ActiveSheet.Comments
    MsgBox (c.Text)
    Next c

    With the msgbox I would like to include the value of the column heading and row heading. So if the comment is in cell B4, I would like the value of B1 and A4.

    Is this possible.

    Thanks is advance.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Comment Cell Location (Excel 2003 VBA)

    Try a variation of this code:

    For Each c In ActiveSheet.Comments
    MsgBox c.Text & vbCrLf & Cells(1, c.Parent.Column) & vbCrLf & Cells(c.Parent.Row, 1)
    Next c

  3. #3
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comment Cell Location (Excel 2003 VBA)

    Your awesome Hans.

    What if I wanted the value of the cell with the comment.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Comment Cell Location (Excel 2003 VBA)

    Use c.Parent.Value

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •