Jed Shields
Active Member
- Joined
- Sep 7, 2011
- Messages
- 283
- Office Version
- 365
- Platform
- Windows
Hi guys,
I'm trying to create a stacked column chart next to a standard column but am having trouble.
For the months Jan to Dec, I want to see s stacked column showing:
Sales 1
Sales 2
Sales 3
So Sales 1 on top of 2 on top of 3
However, next to it I'd like to show a single column for Losses.
I can get it working if I change the chart type of Losses to a line, scatter etc, but I'd really like a comparable column. I can sort of get something along the right lines, by using two columns for each month, Sales in one, Losses in the other, but if I try to change the chart type on one it chnages it for all of them.
If I put Losses on the secondary axis then it seems to work, but I need to make sure that the primary and secondary axis are identical. I've tried doing this with some code that I found but it doesn't appear to work...
Is there an obvious solution? Am I on the right tracks, but ****ed up the code?
I'm trying to create a stacked column chart next to a standard column but am having trouble.
For the months Jan to Dec, I want to see s stacked column showing:
Sales 1
Sales 2
Sales 3
So Sales 1 on top of 2 on top of 3
However, next to it I'd like to show a single column for Losses.
I can get it working if I change the chart type of Losses to a line, scatter etc, but I'd really like a comparable column. I can sort of get something along the right lines, by using two columns for each month, Sales in one, Losses in the other, but if I try to change the chart type on one it chnages it for all of them.
If I put Losses on the secondary axis then it seems to work, but I need to make sure that the primary and secondary axis are identical. I've tried doing this with some code that I found but it doesn't appear to work...
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case "$BQ$3"
ActiveSheet.ChartObjects("Chart 12").Chart.Axes(xlCategory) _
.MaximumScale = Target.Value
Case "$BQ$4"
ActiveSheet.ChartObjects("Chart 12").Chart.Axes(xlCategory) _
.MinimumScale = Target.Value
Case "$BQ$5"
ActiveSheet.ChartObjects("Chart 12").Chart.Axes(xlCategory) _
.MajorUnit = Target.Value
Case "$BR$3"
ActiveSheet.ChartObjects("Chart 12").Chart.Axes(xlValue) _
.MaximumScale = Target.Value
Case "$BR$4"
ActiveSheet.ChartObjects("Chart 12").Chart.Axes(xlValue) _
.MinimumScale = Target.Value
Case "$BR$5"
ActiveSheet.ChartObjects("Chart 12").Chart.Axes(xlValue) _
.MajorUnit = Target.Value
Case Else
End Select
End Sub</pre>
Is there an obvious solution? Am I on the right tracks, but ****ed up the code?