View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Troy[_3_] Troy[_3_] is offline
external usenet poster
 
Posts: 19
Default Adding Comment and AutoSizing

I am having problems getting this to work. Anyone have an idea

If I use the code as written, I get a Run-Time error '1004': Application-defined or object-defined error
Once I remove the line to AutoSize, it works just fine

If I use the Range(ErrorCellAddress) lines, I get a Run-Time error '91': Object variable or With block variable not set
Once I remove the line to AutoSize, it works just fine

Please help!!!

Private Sub Process_CoBn_Click(
Dim WS As Workshee
Set WS = ActiveWorkbook.ActiveShee

If ErrorList_LtBx.ListCount = 0 The
Exit Su
Els
If Not Range(ErrorCellAddress).Comment Is Nothing Then Range(ErrorCellAddress).Comment.Delet

' Range(ErrorCellAddress).Comment.Shape.TextFrame.Au toSize = Tru
' Range(ErrorCellAddress).AddComment ErrorList_LtBx.List(0, 0

With W
.Cells.Range(ErrorCellAddress).AddComment ErrorList_LtBx.List(0, 0) & Chr(13
.Cells.Range(ErrorCellAddress).AddComment.Shape.Te xtFrame.AutoSize = Tru
End Wit
End I
End Sub