I am having troubles formatting columns in a chart to match a specific font, colour, alignment etc.
This code, while focused on column A:A, it applies to every single cell in the worksheet. I only want it to affect Column A:
Sub PGMNumber()
'
' PGMNumber Macro
'
'
Range("A:A").Select
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16776961
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.Color = -16776961
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Selection.Font.Bold = False
Selection.Font.Bold = True
With Selection.Font
.Color = -10477568
.TintAndShade = 0
End With
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("A:A").ColumnWidth = 9.43
End Sub
This was done by recording my steps. All I need is FontName, Colour, Bold, Size and Alignment. Deleting what I don't need breaks the code :(
Can someone help me simplify the code so it will only affect column A?
Also, how do I add the option to include other columns, for example B, C, D, etc.
Lastly, can I have the macro start formatting from A6 downward, B6 downward, C6 downward, etc? That way the header of the chart remains untouched.
Thank you!
