A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Chart macro



 
 
Thread Tools Display Modes
  #1  
Old April 18th, 2009, 11:49 PM posted to microsoft.public.excel.charting
sonicscooter
external usenet poster
 
Posts: 20
Default Chart macro

Hi, i have a button command that brings a embedded chart onto my worksheet,
it works fine, so i wanted to write a simple marco to asighn to another
button to delete the chart when i had finished looking at it, this is what
Excel recorded,

ActiveSheet.ChartObjects("Chart 5029").Activate
ActiveChart.Axes(xlValue).Select
ActiveChart.ChartArea.Select
ActiveWindow.Visible = False
Selection.Delete

Now this works as long as the "Chart 5029" number is the same as on the
chart its self ,ie when i left click and put it in a chart window to see what
the number is along the top of the box, so, i press the button, it works, i
call up a chart again with the other button, press the delete button and
error, because the Chart number as changed to one thats different to the one
in the macro. I don't know what the number is for and how to either stop it
from changing ( why does it change ) or to write a macro to adjust for the
change in this number.

Thanks to anyone who can answer this problem....Cheers
  #2  
Old April 19th, 2009, 03:07 AM posted to microsoft.public.excel.charting
Robert Baer
external usenet poster
 
Posts: 18
Default Chart macro

sonicscooter wrote:
Hi, i have a button command that brings a embedded chart onto my worksheet,
it works fine, so i wanted to write a simple marco to asighn to another
button to delete the chart when i had finished looking at it, this is what
Excel recorded,

ActiveSheet.ChartObjects("Chart 5029").Activate
ActiveChart.Axes(xlValue).Select
ActiveChart.ChartArea.Select
ActiveWindow.Visible = False
Selection.Delete

Now this works as long as the "Chart 5029" number is the same as on the
chart its self ,ie when i left click and put it in a chart window to see what
the number is along the top of the box, so, i press the button, it works, i
call up a chart again with the other button, press the delete button and
error, because the Chart number as changed to one thats different to the one
in the macro. I don't know what the number is for and how to either stop it
from changing ( why does it change ) or to write a macro to adjust for the
change in this number.

Thanks to anyone who can answer this problem....Cheers

Try the following (if chart is selected)..
ActiveWindow.Visible = False
Selection.Name = "Chart 2"
  #3  
Old April 19th, 2009, 03:55 AM posted to microsoft.public.excel.charting
Tushar Mehta[_4_]
external usenet poster
 
Posts: 60
Default Chart macro

Not sure why you want a macro. Select the chart and press the 'Delete' key.

A macro solution will *at the most* save you one keystroke!

--
Tushar Mehta
http://www.tushar-mehta.com
Custom business solutions leveraging a multi-disciplinary approach
In Excel 2007 double-click to format may not work; right click and select
from the menu


"sonicscooter" wrote:

Hi, i have a button command that brings a embedded chart onto my worksheet,
it works fine, so i wanted to write a simple marco to asighn to another
button to delete the chart when i had finished looking at it, this is what
Excel recorded,

ActiveSheet.ChartObjects("Chart 5029").Activate
ActiveChart.Axes(xlValue).Select
ActiveChart.ChartArea.Select
ActiveWindow.Visible = False
Selection.Delete

Now this works as long as the "Chart 5029" number is the same as on the
chart its self ,ie when i left click and put it in a chart window to see what
the number is along the top of the box, so, i press the button, it works, i
call up a chart again with the other button, press the delete button and
error, because the Chart number as changed to one thats different to the one
in the macro. I don't know what the number is for and how to either stop it
from changing ( why does it change ) or to write a macro to adjust for the
change in this number.

Thanks to anyone who can answer this problem....Cheers

  #4  
Old April 19th, 2009, 08:05 AM posted to microsoft.public.excel.charting
Robert Baer
external usenet poster
 
Posts: 18
Default Chart macro

Tushar Mehta wrote:
Not sure why you want a macro. Select the chart and press the 'Delete' key.

A macro solution will *at the most* save you one keystroke!

Perhaps he needs to automate a repetitive procedure, thereby saving
tens to hundreds of keystrojkes and cheese-chaser movements.
  #5  
Old April 19th, 2009, 05:32 PM posted to microsoft.public.excel.charting
sonicscooter
external usenet poster
 
Posts: 20
Default Chart macro

Hi, Robert, i tried what you said but it won't run for some reason, unless im
doing something wrong. Thanks

"sonicscooter" wrote:

Hi, i have a button command that brings a embedded chart onto my worksheet,
it works fine, so i wanted to write a simple marco to asighn to another
button to delete the chart when i had finished looking at it, this is what
Excel recorded,

ActiveSheet.ChartObjects("Chart 5029").Activate
ActiveChart.Axes(xlValue).Select
ActiveChart.ChartArea.Select
ActiveWindow.Visible = False
Selection.Delete

Now this works as long as the "Chart 5029" number is the same as on the
chart its self ,ie when i left click and put it in a chart window to see what
the number is along the top of the box, so, i press the button, it works, i
call up a chart again with the other button, press the delete button and
error, because the Chart number as changed to one thats different to the one
in the macro. I don't know what the number is for and how to either stop it
from changing ( why does it change ) or to write a macro to adjust for the
change in this number.

Thanks to anyone who can answer this problem....Cheers

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.