![]() |
|
#1
|
|||
|
|||
![]()
Hello,
Could pls anybody explain me how to refer to a chartobjects in case of multiple chartobjects are created in excel (via VBA)? i have 1st macro, creating a chart, and the 2nd macro that should delete the same chart. Howerver i dont know how to specify or refer by the 2nd macro to this one specific chart, created by the 1st macro. When for example i create more charts in the sheet manually, the 2nd macro will delete only chart in ChartObjects(1).. i need somehow refer to only that chart, created by the 1st macro. When i create the chart, can i somehow set fixed chartobject of the chart that will not change in case of any other multiple charts in excel? MACRO TO CREATE CHART Code:
Sub CreateChart() Dim MyChart As Chart Dim DataRange As Range Set DataRange = ActiveSheet.Range("A1:A7") Set MyChart = Worksheets("List1").Shapes.AddChart(x1linemarkers, 673, 250, 380, 150).Chart MyChart.SetSourceData Source:=DataRange With MyChart .HasTitle = True .ChartTitle.Text = Worksheets("List1").Range("A10") End With End If End Sub Code:
Sub Delete_main() Worksheets("List1").ChartObjects(1).Delete End If End Sub Filip |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
AUHAMM | Excel | 3 | 10-27-2014 09:11 PM |
Create multiple copies of same email in multiple folders | gaker10 | Outlook | 0 | 10-06-2014 07:44 AM |
![]() |
flds | Excel Programming | 5 | 09-30-2014 09:58 AM |
![]() |
PeterKottas | Word | 2 | 05-19-2014 04:39 AM |
Multiple Input, Multiple Digital Signatures | Jeff | Word | 0 | 01-04-2012 09:03 AM |