Adding Comment and AutoSizing

T

Troy

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.AutoSize = 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.TextFrame.AutoSize = Tru
End Wit
End I
End Sub
 
Top