/ / VBA: चार्ट में श्रृंखला बनाना - एक्सेल, vba, एक्सेल-vba, एक्सेल-सूत्र

VBA: एक चार्ट में श्रृंखला बनाना - एक्सेल, vba, excel-vba, एक्सेल-सूत्र

मैं दो अलग सीरीज़ बनाने की कोशिश कर रहा हूं लेकिन अगरमैं मैक्रो चलाता हूं दूसरी श्रृंखला पहले दुर्भाग्य से ओवरराइटिंग करती है। ताकि अंत में, मेरे पास अपने चार्ट में दूसरी श्रृंखला हो। क्या कोई मदद कर सकता है?

     With ChtObj
"Series LTU
Set Ser = .Chart.SeriesCollection.NewSeries
With Ser
.Name = "=" & Dataws.Cells(CurrentRow, 1).Address(False, False, xlA1, xlExternal)
.XValues = "=" & Dataws.Cells(CurrentRow, 3).Address(False, False, xlA1, xlExternal)
.Values = "=" & Dataws.Cells(CurrentRow, 4).Address(False, False, xlA1, xlExternal)
End With
"Series LTA
With Ser
.Name = "LTA_" & Dataws.Cells(CurrentRow, 1)
.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)
.Values = "=" & Dataws.Cells(CurrentRow, 4).Address(False, False, xlA1, xlExternal) & "," & Dataws.Range(Dataws.Cells(CurrentRow, 42), Dataws.Cells(CurrentRow, 50)).Address(False, False, xlA1, xlExternal)
End With
End With

धन्यवाद!

उत्तर:

जवाब के लिए 2 № 1

समस्या यह है कि आप उसी का उपयोग कर रहे हैं Ser, तो यह बदल दिया गया है।

With ChtObj

Set Ser = .Chart.SeriesCollection.NewSeries

With Ser
.Name = "=" & Dataws.Cells(CurrentRow, 1).Address(False, False, xlA1, xlExternal)
.XValues = "=" & Dataws.Cells(CurrentRow, 3).Address(False, False, xlA1, xlExternal)
.Values = "=" & Dataws.Cells(CurrentRow, 4).Address(False, False, xlA1, xlExternal)
End With
"Series LTA

Set Ser = .Chart.SeriesCollection.NewSeries
With Ser
.Name = "LTA_" & Dataws.Cells(CurrentRow, 1)
.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)
.Values = "=" & Dataws.Cells(CurrentRow, 4).Address(False, False, xlA1, xlExternal) & "," & Dataws.Range(Dataws.Cells(CurrentRow, 42), Dataws.Cells(CurrentRow, 50)).Address(False, False, xlA1, xlExternal)
End With
End With

एक नई श्रृंखला को फिर से परिभाषित करने का प्रयास करें या सीरीज 2 के लिए एक अलग नाम का उपयोग करें।