Sub Macrochart()
Dim myChart As ChartObject
Dim mySeries As Series
Set myChart = ActiveSheet.ChartObjects.Add(100, 50, 200, 200)
With myChart
.Chart.SetSourceData Source:=Selection
.Chart.ChartType = xlColumnClustered
.Chart.ApplyLayout (8)
For Each mySeries In .Chart.SeriesCollection
With mySeries
.Border.LineStyle = xlSolid
.Border.Color = vbBlack
.Interior.Color = vbWhite
End With
Next
End With
End Sub
我想添加选项以选择x值,但我不知道在哪里放置代码行如果可能id喜欢同时选择y和x值然后运行宏来获取柱形图是无论如何要做到这一点?我对vba真的很新,所以如果答案很明显,我很抱歉:)