macro to read the cell's comment

ramkumarcn

Board Regular
Joined
Jun 21, 2011
Messages
114
Hi,

I want to design a macro to check if the cell has a comment in it. If so, the macro should read the comment and store it in a variable. Please help me on this.

Ram
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try like this

Code:
Sub test()
Dim cmt As Comment, s As String
On Error Resume Next
Set cmt = ActiveCell.Comment
On Error GoTo 0
If cmt Is Nothing Then
    MsgBox "No comment"
Else
    s = cmt.Text
    MsgBox s
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,069
Messages
6,053,347
Members
444,654
Latest member
Rich Cohen

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