Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
Could anyone please let me know how I can delete a specific graph on specific sheet in VBA . I have tried inserting it as an object but thi doesn't work as I believe it already is an object. I have trie referring to its TopLeftCell address, I don't think this works and have also tried the old Workbook.Charts.Delete Can anyone please help -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sheets(1).ChartObjects("Chart 2").Delete
will delete a chart- no need to create as an object -- Message posted from http://www.ExcelForum.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is correct code however it is not adequate. What happens in my ap
is that when the user wishes to see the graph they click on a button Thus as the graph is being created it gets a name like ("Chart 207" thus I what I need to do in my app is firstly check if the graph i there... if it is then it should be deleted AND additionally I need to know ho to reference the graph. eg. Because excel comes up with random grap names I can just hardcode a.... Sheets("Main").ChartObjects("Chart 276").Delete Because Chart 276 won't always be chart 276. Thanks for your help initially, do you have any other ideas?? -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you are using only one chart on a page you could use
Worksheets("Main").ChartObjects(1).Delete This let me clear a chart from my worksheet. Dont know if this is the proper way to do this but it worked for me. Davi -- Message posted from http://www.ExcelForum.com |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about when creating the chart assign to object var
sub CreateChart dim chMyChart set chMyChart = Charts.Add .... .... You can then refer to the chart as a variable. Other options include looping through all the chart objects in a sheet- something like Dim chMyChart For Each chMyChart In ActiveSheet.ChartObjects ..... Next .... Duncan --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need Urgent Help Creating a Formula | Excel Discussion (Misc queries) | |||
Creating a graph similar to a stacked column graph | Charts and Charting in Excel | |||
VB script in Excel object in Powerpoint (Urgent) | Excel Discussion (Misc queries) | |||
Unable to access GridLines in Microsoft Graph Object [URGENT] | Charts and Charting in Excel | |||
Urgent: Object Explicit Error | Excel Programming |