Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Programming Comments in Excel 2003

Hello,

I am programming a userform to input and edit records in a spreadsheet. I
have a couple of textboxes in the form that I am using to add comment boxes
to certain cells. I am trying to find a way to set the comment boxes format
to automatic size within the userform's code. This way long comments will be
entirely visible when the mouse hovers over the comment.

Any help or suggestions would be very helpful.

Thanks,


-Brandon

  #2   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Programming Comments in Excel 2003

Here is a function you can use to auto size cell comments (copy to standard
code module):

Public Function CommentAutoSizeRange(argAddress As Range)
'FUNCTION AUTO-SIZES THE COMMENT IN THE CELL SUPPLIED;
argAddress.Comment.Visible = True
argAddress.Comment.Shape.Select True
Selection.AutoSize = True
argAddress.Comment.Visible = False
End Function

Call the above like so:

Private Sub CommandButton1_Click()
Dim rngCell As Range
Set rngCell = ActiveCell
Call CommentAutoSizeRange(rngCell)
End Sub

This function resizes all comments in the sheet:

Public Function CommentsAutoSizeAll()
'AUTO-SIZE ALL COMMENTS IN THE ACTIVESHEET;
Dim cmt As Comment
Dim cmts As Comments
Set cmts = ActiveSheet.Comments
For Each cmt In cmts
cmt.Shape.TextFrame.AutoSize = True
Next
End Function

HTH

"Brandon" wrote:

Hello,

I am programming a userform to input and edit records in a spreadsheet. I
have a couple of textboxes in the form that I am using to add comment boxes
to certain cells. I am trying to find a way to set the comment boxes format
to automatic size within the userform's code. This way long comments will be
entirely visible when the mouse hovers over the comment.

Any help or suggestions would be very helpful.

Thanks,


-Brandon

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 Programming molinaram Excel Discussion (Misc queries) 3 January 23rd 07 12:04 AM
Programming Comments from the inside!! Asistance Please tristandelsur Excel Programming 0 October 4th 05 04:29 PM
Excel 2003 & add-in programming Bill Youngman Excel Programming 5 September 20th 05 03:05 PM
programming excel 97 from .net 2003 gabe Excel Programming 6 April 4th 05 06:43 PM
Programming in Excel 2003! Surmax Excel Programming 1 February 12th 04 09:13 PM


All times are GMT +1. The time now is 09:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"