Solved

Excel VBA change the size of cooment to fit text

Posted on 2014-10-29
3
109 Views
Last Modified: 2014-10-29
Hi
What VBA code would I use to change the size of a comment box to fit the text within it?
0
Comment
Question by:murbro
3 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 40410459
Hi,

pls try

ActiveCell.Comment.Shape.TextFrame.AutoSize = True

Regards
0
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
ID: 40410630
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
 

Author Closing Comment

by:murbro
ID: 40410676
Great. Thanks
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question