Solved

Excel VBA change the size of cooment to fit text

Posted on 2014-10-29
3
117 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 50

Accepted Solution

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

pls try

ActiveCell.Comment.Shape.TextFrame.AutoSize = True

Regards
0
 
LVL 47

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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.

733 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