2017-11-29 19 views
0

複数のX値を持つ新しい系列をVBAで作成しようとしています。VBA:複数のX値を持つグラフで系列を作成する方法

X値が1つしかないシリーズを作成するときは問題ありませんが、それ以上は動作しません。誰も助けることができますか?

作品:

は動作しません

.XValues = "=" & Dataws.Cells(CurrentRow, 3).Address(False, False, xlA1, xlExternal) 
(実行時エラーが1004):

.XValues = "=" & Dataws.Cells(CurrentRow, 3) & Dataws.Cells(CurrentRow, 14) & Dataws.Cells(CurrentRow, 15) & Dataws.Cells(CurrentRow, 16) & Dataws.Cells(CurrentRow, 17) & Dataws.Cells(CurrentRow, 18) & Dataws.Cells(CurrentRow, 19) & Dataws.Cells(CurrentRow, 20) & Dataws.Cells(CurrentRow, 21) & Dataws.Cells(CurrentRow, 22).Address(False, False, xlA1, xlExternal) 

ありがとうございました!

答えて

1

XValuesのアドレスはコンマで区切る必要があります。ですから、& "," &で2つのアドレスを接続する必要があり=[Map1]Sheet1!C1,[Map1]Sheet1!N1:V1


結果は次のようになります。

.XValues = "=" & dataws.Cells(CurrentRow, 3).Address(False, False, xlA1, xlExternal) & "," & _ 
    dataws.Range(dataws.Cells(CurrentRow, 14), dataws.Cells(CurrentRow, 22)).Address(False, False, xlA1, xlExternal) 

連続細胞のような1つの範囲のアドレスに組み合わせることが可能である:だから、あなたがそれらを個別に追加する必要はありませんセル22までのセル14を意味

dataws.Range(dataws.Cells(CurrentRow, 14), dataws.Cells(CurrentRow, 22)) 

関連する問題