View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
DCPan DCPan is offline
external usenet poster
 
Posts: 11
Default VBA "auto-sizing" comment box

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