Cell Notes

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,480
Is there a way to extract a cell note via VBA?

Rather than using Comments, Notes will be used as when I try to use the CommentThreaded command my workbook crashes so I'm assuming there is a bug somewhere causing this.

I also want to add a text string to a cell as a Note as well if this is possisble.


Thanks
 

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

davesexcel

Well-known Member
Joined
Feb 26, 2006
Messages
1,084
Notes in the new xl are in fact the original comment from old.

Get the comment from H1

VBA Code:
Sub Button3_Click()
    Dim rng         As Range, s As String
   
    Set rng = Range("H1")
    With rng
        If Not .Comment Is Nothing Then
            s = .Comment.Text
            MsgBox s
        End If
    End With
   
End Sub
 

sykes

Well-known Member
Joined
May 1, 2002
Messages
1,779
Office Version
  1. 365
Platform
  1. Windows
This will add a comment if there's not one there, but if one already exists, extract it to the adjacent cell.
Hopefully, this should be enough to demo a solution to both of your questions.
NB Test on a COPY of your work, first!
VBA Code:
Sub cmnt()
Dim cmttxt As String
Dim rng As Range

Set rng = ActiveCell
    If rng.Comment Is Nothing Then rng.AddComment ("New comment added"): Exit Sub
    rng.Offset(0, 1).Value = rng.Comment.Text

End Sub
 

sykes

Well-known Member
Joined
May 1, 2002
Messages
1,779
Office Version
  1. 365
Platform
  1. Windows
Pleasure. Hope it's enough for you to implement your own solution.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,154
Messages
5,600,024
Members
414,356
Latest member
death20

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
Top