Simply wanting to change the line color of columns E and B , this is my code:
Sub HistoricalProdUnitAndDemand()
' Creates a line chart for the demand column
Worksheets("DATA").Activate
' Doesn't work because it is looking for a Worksheet not a SHEET WTF
For Each Ws In Sheets
If Ws.Name = "Production VS Demand" Then
Application.DisplayAlerts = False
Sheets("Production VS Demand").Delete
Application.DisplayAlerts = True
Exit For
End If
Next
Columns("A:A").Select
Selection.NumberFormat = "[$-en-US]mmm-yy;@"
' This formats column A to be in the proper date format of mmm-yy
Range("A:A,E:E,B:B").Select
ActiveSheet.Shapes.AddChart2(332, xlLineMarkers).Select
ActiveChart.SetSourceData Source:=Range("A:A,E:E,B:B")
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Production VS Demand"
' Places line chart in a new worksheet called Production VS Demand
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.Orientation = 70
Selection.MajorTickMark = xlNone
ActiveChart.ChartTitle.Select
ActiveChart.ChartTitle.Text = "Production VS Demand"
' Adds in the chart's title
ActiveChart.SetElement (msoElementLegendRight)
' Adds in the chart's legend to the right
Selection.Format.TextFrame2.TextRange.Characters.Text = "Production VS Demand"
With Selection.Format.TextFrame2.TextRange.Characters(1, 20).ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With
ActiveChart.ChartArea.Select
End Sub