itsmekarak
New Member
- Joined
- Sep 29, 2014
- Messages
- 30
Hello all,
A large part of my workday involves reviewing worksheets containing comments. Some comments are formatted perfectly whereas others need resizing. In turn I find myself doing the same activity over and over again to format them; which led me to discover this auto formatting macro:
Sub AutoFormatComments()
Dim MyComments As Comment
Dim lArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Shape.TextFrame.AutoSize = True
If .Shape.Width > 150 Then
lArea = .Shape.Width * .Shape.Height
'Width of 150 gets me as close to 9.26cm as feasible
.Shape.Width = 150
.Shape.Height = (lArea / 150) * 0.75
End If
End With
Next ' comment
Dim cmt As Comment
For Each cmt In ActiveSheet.Comments
cmt.Shape.Top = cmt.Parent.Top + 5
cmt.Shape.Left = _
cmt.Parent.Offset(0, 1).Left + 5
Next ' comment
End With
Next 'comment
End Sub
This is a fantastic script in that it sets the width of the comment and then auto adjusts for the height base on the amount of text. It would be perfect if it could just include these additional features:
Can someone assist with modifying this macro? Thank you in advance for any and all help!
Sincerely,
Kara
A large part of my workday involves reviewing worksheets containing comments. Some comments are formatted perfectly whereas others need resizing. In turn I find myself doing the same activity over and over again to format them; which led me to discover this auto formatting macro:
Sub AutoFormatComments()
Dim MyComments As Comment
Dim lArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Shape.TextFrame.AutoSize = True
If .Shape.Width > 150 Then
lArea = .Shape.Width * .Shape.Height
'Width of 150 gets me as close to 9.26cm as feasible
.Shape.Width = 150
.Shape.Height = (lArea / 150) * 0.75
End If
End With
Next ' comment
Dim cmt As Comment
For Each cmt In ActiveSheet.Comments
cmt.Shape.Top = cmt.Parent.Top + 5
cmt.Shape.Left = _
cmt.Parent.Offset(0, 1).Left + 5
Next ' comment
End With
Next 'comment
End Sub
This is a fantastic script in that it sets the width of the comment and then auto adjusts for the height base on the amount of text. It would be perfect if it could just include these additional features:
- Run for only one cell instead of all cells in a worksheet
- Change the font to the following:
- Choose Calibri for the font
- Choose Bold for the font style
- Choose size 9 for the font size
- Choose Red for the font color on the 1st line only
- Choose Black for the font color for all remaining text
- Set it to move but don't size with cells
- Set it to a keyboard shortcut of Ctrl + T
Can someone assist with modifying this macro? Thank you in advance for any and all help!
Sincerely,
Kara