Hey, guys.
I have two graphs that represent similar data for different organizations. I apply a custom graph type to the graphs and 95% of the time this works fine; I also stabalize the major unit, max & min on the axes, so they are the same for both grapsh Every once in a while, though, one .PlotArea.InsideHeight is larger than the other one (generally because of issues with displaying the labels). Since these graphs are being compared together, I need the .PlotArea.InsideHeight to be the same height -- but I can't set it in Excel, as it's a read only variable. The code below was what someone here in the office came up with to fix it, but it doesn't seem to work right. Any ideas?
With nChart
'other random code is here
sgl1 = .PlotArea.InsideHeight
End With
With cbChart
'other random code is here
sgl2 = .PlotArea.InsideHeight
End With
If Abs(sgl1 - sgl2) > 2 Then
If sgl2 > sgl1 Then
cbChart.PlotArea.Height = cbChart.PlotArea.Height - (sgl2 - sgl1)
Else:
nChart.PlotArea.Height = nChart.PlotArea.Height - (sgl1 - sgl2)
End If
End If
Thanks!
I have two graphs that represent similar data for different organizations. I apply a custom graph type to the graphs and 95% of the time this works fine; I also stabalize the major unit, max & min on the axes, so they are the same for both grapsh Every once in a while, though, one .PlotArea.InsideHeight is larger than the other one (generally because of issues with displaying the labels). Since these graphs are being compared together, I need the .PlotArea.InsideHeight to be the same height -- but I can't set it in Excel, as it's a read only variable. The code below was what someone here in the office came up with to fix it, but it doesn't seem to work right. Any ideas?
With nChart
'other random code is here
sgl1 = .PlotArea.InsideHeight
End With
With cbChart
'other random code is here
sgl2 = .PlotArea.InsideHeight
End With
If Abs(sgl1 - sgl2) > 2 Then
If sgl2 > sgl1 Then
cbChart.PlotArea.Height = cbChart.PlotArea.Height - (sgl2 - sgl1)
Else:
nChart.PlotArea.Height = nChart.PlotArea.Height - (sgl1 - sgl2)
End If
End If
Thanks!