0
私は、入力されたデータを自動的にコピーし、新しいレコードをテーブルに追加し、そのレコードのセルを再現する小さなコントロールパネルを作成しました。挿入のために、マクロはテーブルの最後の空行を検索し、そこにデータを挿入します。Excelでレコード/セルをグラフにリンクするにはどうすればよいですか? FullSeriesCollection
ここで、別のワークシートのグラフに同じレコードをテーブルのレコードとリンクして追加したいとします。
残念ながら、私のコードは期待どおりに動作せず、理由はわかりません。あなたが私を助けることを願っています!
Sub DatensatzAnlegen()
'Find next clear row
Range("A6:M6").Select
Selection.Copy
CurrentRow = 13
Do Until Range("A" & CurrentRow) = ""
CurrentRow = CurrentRow + 1
Loop
Cells(CurrentRow, 1).Activate
ActiveSheet.Paste
Range("E9:M9").Select
Selection.Copy
Cells(CurrentRow, 14).Activate
ActiveSheet.Paste
'Recolor cell of the new record
Cells(CurrentRow, 1).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent1
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With
'Link data with chart
Sheets("Diagramm").ChartObjects("DiagrammA").Activate
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection.Name = Sheets("Übersicht").Cells(CurrentRow, 1) 'DOES NOT WORK
ActiveChart.FullSeriesCollection.XValues = Sheets("Übersicht").Cells(CurrentRow, 2) 'DOES NOT WORK
ActiveChart.FullSeriesCollection.Values = Sheets("Übersicht").Cells(CurrentRow, 3) 'DOES NOT WORK
'Clear control panel
ActiveSheets.Übersicht
Range("A6:M6").Select
Selection.ClearContents
Range("E9:M9").Select
Selection.ClearContents
End Sub
ありがとう!私は、テーブルに新しいレコードを追加しようとするたびに、A14のデータが上書きされるという新たな問題があると考えています。 .Range( "A6:M6")。コピー先:=。範囲( "A"&CurrentRow)は機能しません。私は1004ランタイムエラーが発生します。 – RuilGaga