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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|