Solved

Excel VBA change the size of cooment to fit text

Posted on 2014-10-29
3
102 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 48

Accepted Solution

by:
Rgonzo1971 earned 250 total points
Comment Utility
Hi,

pls try

ActiveCell.Comment.Shape.TextFrame.AutoSize = True

Regards
0
 
LVL 45

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
Comment Utility
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
Comment Utility
Great. Thanks
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now