2016-03-27 7 views
0

新しいchart1シートを追加し、sheet1からseries1を私のchart1シートに追加しようとしています。ここでグラフにシリーズを追加する方法

は私のコードです...

Charts.Add 
With ActiveChart 
    .ChartType = xlLine 
    .HasTitle = True 
    .ChartTitle.Text = "Closing Price" 
    .SeriesCollection.NewSeries 
    .FullSeriesCollection.XValues = "=Sheet1!$A$2:$A$741" '<<<<This is the xvalue 
    .FullSeriesCollection.Values = "=Sheet1!$B$2:$B$741" '<<<<This are the value 
End With 

これを行う方法を教えてください。..アドバンス

で おかげ

答えて

0

をあなたはシリーズコレクションの数を指定する必要があります。ところで

Charts.Add 
With ActiveChart 
    .ChartType = xlLine 
    .HasTitle = True 
    .ChartTitle.Text = "Closing Price" 
    .SeriesCollection.NewSeries 
    .FullSeriesCollection(1).XValues = "=Sheet1!$A$2:$A$741" '<<<<This is the xvalue 
    .FullSeriesCollection(1).Values = "=Sheet1!$B$2:$B$741" '<<<<This are the value 
End With 

は、あなたが、マクロレコーダーを起動し、新しいグラフシートを挿入し、新しいシリーズを定義するためにトラブルを取った場合、マクロの記録を停止し、あなたが完全な形でレイアウトされたすべてのコマンドを見るでしょう。