ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding Comment and AutoSizing (https://www.excelbanter.com/excel-programming/299598-adding-comment-autosizing.html)

Troy[_3_]

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


All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com