reposition comments

J

Jock

Hi,
How can I use VBA to show comments above the cell they are attached to
rather than to the right? I have found that as the user moves accross the
spreadsheet, the comments in the right most columns disappear off the screen
until the user scrolls accross. More than a bit annoying!
Thanks,
 
P

Patrick Molloy

Option Explicit
Sub AddComment()
AddCommentToCell Range("C12"), "Hello World - Left", True
AddCommentToCell Range("C13"), "Hello World - Right"
End Sub
Sub AddCommentToCell(target As Range, text As String, Optional bLEFT As
Boolean)
Dim cm As comment
Set cm = target.AddComment
With cm
.text text:=text
With .Shape
If bLEFT Then
.Left = target.Left - Range("C12").Width
End If
.Width = target.Width
End With
.Visible = True
End With
End Sub
 

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

Top