Im tryng to write a macro that always applies the same formatting to the series in my chart, based on what kind of data the series is. For instance, if the series is “Actual” data it should be represented by blue bars with a frame around, if the series is “Year to go” data it should be represented by red bars with a frame around. My macro so far looks like this:
______________________________
Sub Ändra_Bars_Lines()
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
Räknare = 0
<o></o>
Diagramdata = ThisWorkbook.Sheets("DATA_CHART").Range("AI1")
<o></o>
For Each Cell In Range(Diagramdata)<o></o>
Räknare = Räknare + 1
<o></o>
Select Case Cell.Offset(0, -4)
<o></o>
<o></o>
Case "ACT"<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Interior.Color = RGB(0, 0, 255)<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Border.LineStyle = xlDash
<o></o>
<o></o>
Case "YTG"<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Interior.Color = RGB(255, 0, 0)<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Border.LineStyle = xlDash
<o></o>
<o></o>
Case "PRO"<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Interior.Color = RGB(0, 255, 0)
<o></o>
<o></o>
Case "BUD"<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Interior.Color = RGB(0, 0, 0)
<o></o>
End Select
<o></o>
Next
<o></o>
End Sub<o></o>
<o></o>
____________________________________
Now this is all good. What I also want to do (but don’t know how) is:
- Add shadows to the “ACT” and “YTG” bars (equivalent of doing: Format data series – Shadow – Presets – Offset diagonal bottom right)
- Make the “PRO” bars a line with a shadow(equivalent of doing: Change series chart type – Line, Format data series – Shadow – Presets – Offset diagonal bottom right)
- Make the “BUD” bars a dotted line (equivalent of doing: Change series chart type – Line, Format data series – Linestyle – Dash type – Long dash)
When I use the macro recorder it does not record any of those actions. I have tried searching the net for these variables but to no avail.
______________________________
Sub Ändra_Bars_Lines()
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
Räknare = 0
<o></o>
Diagramdata = ThisWorkbook.Sheets("DATA_CHART").Range("AI1")
<o></o>
For Each Cell In Range(Diagramdata)<o></o>
Räknare = Räknare + 1
<o></o>
Select Case Cell.Offset(0, -4)
<o></o>
<o></o>
Case "ACT"<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Interior.Color = RGB(0, 0, 255)<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Border.LineStyle = xlDash
<o></o>
<o></o>
Case "YTG"<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Interior.Color = RGB(255, 0, 0)<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Border.LineStyle = xlDash
<o></o>
<o></o>
Case "PRO"<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Interior.Color = RGB(0, 255, 0)
<o></o>
<o></o>
Case "BUD"<o></o>
Worksheets("CHART").ChartObjects("Chart 1049").Chart.SeriesCollection(Räknare).Interior.Color = RGB(0, 0, 0)
<o></o>
End Select
<o></o>
Next
<o></o>
End Sub<o></o>
<o></o>
____________________________________
Now this is all good. What I also want to do (but don’t know how) is:
- Add shadows to the “ACT” and “YTG” bars (equivalent of doing: Format data series – Shadow – Presets – Offset diagonal bottom right)
- Make the “PRO” bars a line with a shadow(equivalent of doing: Change series chart type – Line, Format data series – Shadow – Presets – Offset diagonal bottom right)
- Make the “BUD” bars a dotted line (equivalent of doing: Change series chart type – Line, Format data series – Linestyle – Dash type – Long dash)
When I use the macro recorder it does not record any of those actions. I have tried searching the net for these variables but to no avail.