我正在尝试替换图表中所有系列的xvalues和值,但是在引用当前值时遇到问题。我的消息框显示为空白。解决之后,我只想替换该值范围的行...例如,如果我有“ = Sheet1!$ D $ 5:$ D $ 16”,我需要获取第一行和最后一行并能够替换它们自动。现在,我需要正确获取值和xvalues ...并尝试删除这些值,而msgbox为空白。
Sub test()
Dim cht As ChartObject
Dim srs As Series
Dim sht As Worksheet
Dim rng As String
Dim rngx As String
Dim i As Long
Dim j As Long
Set sht = ThisWorkbook.ActiveSheet
For Each cht In sht.ChartObjects
cht.Activate
For i = 1 To ActiveChart.SeriesCollection.Count
With ActiveChart.SeriesCollection(i)
.XValues = rngx
.Values = rng
MsgBox rngx
End With
Next i
Next cht
End Sub