• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 132
  • Last Modified:

Excel VBA change the size of cooment to fit text

Hi
What VBA code would I use to change the size of a comment box to fit the text within it?
0
Murray Brown
Asked:
Murray Brown
2 Solutions
 
Rgonzo1971Commented:
Hi,

pls try

ActiveCell.Comment.Shape.TextFrame.AutoSize = True

Regards
0
 
Martin LissRetired ProgrammerCommented:
You are probably going to need to addd the following to Rgonzo1971's suggestion, otherwise an error will occur if there is no comment.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With ActiveCell
    If Not .Comment Is Nothing Then
        .Comment.Shape.TextFrame.AutoSize = True
    End If
End With
End Sub

Open in new window

0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Great. Thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now