View Single Post
  #2   Report Post  
Alan
 
Posts: n/a
Default

"JJ" wrote in message
...

I have created a function that allows me to see a change everytime
there is a change on the worksheet. A comment box will appear and
continue to append the changes, unlike the "track changes function".
I can not seem to figure out why my comment box will not
autosize......I have attached my code. Does anyone know what I am
doing wrong?

Function Worksheet_Change(ByVal Target1 As Excel.range)
With activecell.Offset(0, 0).range("A1")
On Error Resume Next
oldtext = .Comment.Text
If Err < 0 Then .AddComment
newtext = oldtext & "Changed to " & .Text & _
" by " & Application.UserName & " at " & Now & vbLf
.Comment.Text newtext
.Comment.Visible = True
.Comment.Shape.Select True
.autosize = True
.Comment.Visible = True
End With
End Function


Hi,

It appears from reading your code that the autosize method is being
applied to the cell (range) and not the comment itself.

You need to reference the shape property of the comment object to
return a shape object and then re-size that something like:

ActiveSheet.Range("D13").Comment.Shape.ScaleWidth 1.3, msoFalse,
msoScaleFromTopLeft

The 1.3 was chosen randomly.

BTW, what does the .range("A1") on the end of the first line do?


HTH,

Alan.