LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Chart formatting - CommandButton

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Link embedded chart to a commandbutton? Bob Charts and Charting in Excel 7 June 19th 09 02:01 PM
CommandButton Alvin Hansen[_2_] Excel Programming 3 August 16th 04 06:35 PM
CommandButton chris[_12_] Excel Programming 1 April 15th 04 01:01 AM
CommandButton rwebster3 Excel Programming 0 April 14th 04 08:16 PM
Commandbutton David Fixemer Excel Programming 2 February 25th 04 10:18 PM


All times are GMT +1. The time now is 08:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"