Hi all,
I'm rather new to excel VBA actually a newbie in using vba,
I recorded some things i want to automatically change on all comments.
Can someone please help explaining why this code isn't working on all my comment cells?
Sub Comments_changemargin()
Dim MyComments As Comment
Dim LArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Name = "Cambria"
.FontStyle = "Regular"
.Size = 11
.StrikeThrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
End With
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.Orientation = xlHorizontal
.AutoSize = True
End With
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 1
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.RGB = RGB(186, 179, 163)
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
Selection.ShapeRange.TextFrame.MarginLeft = 1.42
Selection.ShapeRange.TextFrame.MarginRight = 1.42
Selection.ShapeRange.TextFrame.MarginTop = 1.42
Selection.ShapeRange.TextFrame.MarginBottom = 1.42
End Sub
Next 'comment
End Sub
Thank you very much for all the help in advance.
I'm rather new to excel VBA actually a newbie in using vba,
I recorded some things i want to automatically change on all comments.
Can someone please help explaining why this code isn't working on all my comment cells?
Sub Comments_changemargin()
Dim MyComments As Comment
Dim LArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Name = "Cambria"
.FontStyle = "Regular"
.Size = 11
.StrikeThrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
End With
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.Orientation = xlHorizontal
.AutoSize = True
End With
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 1
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.RGB = RGB(186, 179, 163)
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
Selection.ShapeRange.TextFrame.MarginLeft = 1.42
Selection.ShapeRange.TextFrame.MarginRight = 1.42
Selection.ShapeRange.TextFrame.MarginTop = 1.42
Selection.ShapeRange.TextFrame.MarginBottom = 1.42
End Sub
Next 'comment
End Sub
Thank you very much for all the help in advance.