collectorskingdom
New Member
- Joined
- Feb 10, 2018
- Messages
- 3
Hello. I'm new to the forum and I am not well versed in VBA. As you are aware, comments
I tried some of the solutions I saw in earlier threads that appeared to serve the same purpose, but I could not get them to work properly.
Here's what used to work for me:
Public AppWB As Workbook
Sub Autpen()
AppWBName = ThisWorkbook.Name
Set AppWB = Workbooks(AppWBName)
Dim ws As Worksheet
On Error Resume Next
For Each ws In AppWB.Worksheets
For Each cmt In ws.Comments
'Modify your comment code
cmt.Shape.TextFrame.AutoSize = True
cmt.Visible = False
cmt.Shape.Top = cmt.Parent.Top - 10
cmt.Shape.Left = cmt.Parent.Offset(,1).Left + 10
Next
Next ws
End Sub
Thank you in advance.
frequently get moved and resized.
With the help of a friend, I was able to get the following macro to properly resize and reposition all comments in each worksheet within my workbook. I
t worked great for about 6 months, but now it does not work any more. When I "comment out" the "On Error Resume Next,"
I receive a "Run-time error '1004': Application-defined or object-defined error."
The macro errors at "cmt.Shape.TextFrame.AutoSize = True."I tried some of the solutions I saw in earlier threads that appeared to serve the same purpose, but I could not get them to work properly.
Here's what used to work for me:
Public AppWB As Workbook
Sub Autpen()
AppWBName = ThisWorkbook.Name
Set AppWB = Workbooks(AppWBName)
Dim ws As Worksheet
On Error Resume Next
For Each ws In AppWB.Worksheets
For Each cmt In ws.Comments
'Modify your comment code
cmt.Shape.TextFrame.AutoSize = True
cmt.Visible = False
cmt.Shape.Top = cmt.Parent.Top - 10
cmt.Shape.Left = cmt.Parent.Offset(,1).Left + 10
Next
Next ws
End Sub
Thank you in advance.