Solved

Excel VBA change the size of cooment to fit text

Posted on 2014-10-29
3
120 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 51

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
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.

707 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