Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I wrote the following code aiming to format different parameters in a chart. The purpose is to run the macro after having selected a chart in the worksheet (ie the one you specifically want to change) . --------------------------------- Sub InsideChartFormat() ' '05/10/2004 - rvg ' ActiveChart.ChartArea.Select Selection.AutoScaleFont = False With Selection.Font .Name = "Arial" .FontStyle = "Regular" .Size = 12 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With 'Plot Area ActiveChart.PlotArea.Select Selection.Left = 1 Selection.Top = 10 Selection.Width = 600 Selection.Height = 650 'Legend ActiveChart.Legend.Select With Selection .Top = 40 .Left = 50 .Width = 120 .Height = 50 End With End Sub ----------------------------------- Everything worked perfectly... but I tried to assign the macro to a CommandButton. Then, my problem is as follow : after having selected my chart, I click on the CommnandButton. The routine starts, then stops with an '91' error type. Could someone help me to fix this ?! Acheron PS : I guess that clicking on the CommandButton has an impact such as deselecting the chart or changing it into a Shape object instead of a ChartObject ... but I'm stuck. Note that using a CommandButton is really, really convenient. Putting an extra button in a toolbar is not an option, considering that I have about 12 different types of charts in my sheet requiring different formatting. Consequently, to be 'user friendly', I need to put a CommandButton next to each type of chart (a type can include a few charts, but not all of them need to be re-formatted, reason why the user must have the choice to select a specific chart ). |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Link embedded chart to a commandbutton? | Charts and Charting in Excel | |||
CommandButton | Excel Programming | |||
CommandButton | Excel Programming | |||
CommandButton | Excel Programming | |||
Commandbutton | Excel Programming |