View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sheeloo[_3_] Sheeloo[_3_] is offline
external usenet poster
 
Posts: 1,805
Default VBA "auto-sizing" comment box

Suppose somehow you were able to autosize the width...
how would you expect to see a comment like "Test Comment"? Comment box
expanded vertically with one letter per line?
If yes then use
..Orientation = xlVertical

If you want horizontal orientation and get the comments adjusted vertically
then while typing the comment you need to do ALT-ENTER for second line or
insert that through code where you want the comment to expand vertically...

--
Always provide your feedback so that others know whether the solution worked
or problem still persists ...


"DCPan" wrote:

Hi all,

The script I attached below will place what is typed in the cell into a
comment box, then replace the cell with "see comments" and delete the comment
box when "see comments" is erased.

Now, the question is...I have auto-size turned on...but why does the comment
box only format itself "length wise"?

Can I specify a comment box width and only have it autosize vertically?

Thanks!
_________________

If Target.Row 1 And Target.Column = 14 _
And Range(strRange).Value < "See Comment" _
And Range(strRange).Value < "" Then

Range(strRange).Value = "See Comment"
Range(strRange).Select
Range(strRange).AddComment
Range(strRange).Comment.Visible = True
Range(strRange).Comment.Text Text:=strComment
Range(strRange).Comment.Shape.Select True
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.ReadingOrder = xlContext
.Orientation = xlHorizontal
.AutoSize = True
End With
Range(strRange).Comment.Visible = False
Range(strRange).Select
'Range("A" & (Target.Row + 1)).Select

Else

If Target.Row 1 And Target.Column = 14 _
And Range(strRange).Value = "" Then

Range(strRange).Select
Range(strRange).ClearComments

End If

Range(strRange).Select
'Range("A" & (Target.Row + 1)).Select

End If