excel vba中散点图如何交换X轴Y轴系列值
发布网友
发布时间:2022-10-10 23:44
我来回答
共1个回答
热心网友
时间:2023-10-09 20:56
参考:
Sub test()
Dim cht As Chart
Set cht = ActiveChart
If cht Is Nothing Then
MsgBox "Select a chart"
Exit Sub
End If
ToggleXY cht, 1
End Sub
Sub ToggleXY(cht As Chart, n As Long)
Dim tmp As String
Dim arr() As String
Dim sr As Series
Set sr = cht.SeriesCollection(n)
arr = Split(sr.Formula, ",")
tmp = arr(2)
arr(2) = arr(1)
arr(1) = tmp
sr.Formula = Join(arr, ",")
End Sub