我在一张纸上有几个条形图,希望这些条形具有相同的增稠度。图表上链接有切片器,因此输入不断变化,每次更改选择时,条形就会变粗或变细。
有人可以帮助我提供一个使图表中的柱形保持相同的密度的代码吗?我不在乎酒吧之间的空间。我已经搜索了互联网,但找不到任何真正的解决方案。
答案 0 :(得分:1)
我认为这可以解决您的问题:
Sub SetBarWitdh()
Dim sh As Shape
Dim ch As Chart
Dim ws As Worksheet
Set ws = Sheets("SheetNameHere") 'Put the name of the sheet where the charts are
stored
For Each sh In ws.Shapes 'This will loop through all the shapes in that sheet
If sh.Type = msoChart Then Set ch = sh.Chart 'If you only have charts on the Sheet _
you can type only the set instrunction
ch.ChartGroups(1).GapWidth = 120 'You can change the number of the property _
to better suit you, you'll have to test untill _
you find it
Next
End Sub