Inserting notes into range of cells

mr.guy

New Member
Joined
Jan 22, 2012
Messages
2
I am new to VB and am struggling to find a more elegant way of inserting comments into a range of cells (c2:d35) so have brute forced it. I would also like to autosize the comments but don't want to create this the same way as I have inserted the comments. Any help you can provide would be much appreciated.

Here is the code to insert the comments, I have eliminated the all but the last line.
range("d35").AddComment range("Cd35").Value

Here is the code where I re-size the comment fields. Again it works but I don't want to retype it all in for each cell range.

Set mycomment = range("c2") '.Comment
mycomment.Comment.Shape.TextFrame.AutoSize = True
mycomment.Comment.Visible = True

Thanks in advance for your help.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Code:
For tRow = 2 To 35
    On Error Resume Next
    Cells(tRow, 4).ClearComments
    On Error GoTo 0
    
    Cells(tRow, 4).AddComment
    Cells(tRow, 4).Comment.Text Text:=Cells(tRow, 3).Text
    Cells(tRow, 4).Comment.Shape.TextFrame.AutoSize = True
    Cells(tRow, 4).Comment.Visible = True
Next tRow
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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