Multiple Active Worksheets
Arne,
You can loop through the "Selection", checking if you have any ChartObjects.
Also, change your SizeTheChart to accept an argument of a ChartObject, so
you can pass any found in the loop :
Private Sub CommandButton1_Click()
Dim obj As Object
For Each obj In Selection
If TypeName(obj) = "ChartObject" Then
Call SizeTheChart(obj)
End If
Next
End Sub
Sub SizeTheChart(argChart As ChartObject)
Dim mySize As Double
With argChart
.ApplyCustomType ChartType:=xlUserDefined, TypeName:="Standard"
....etc
NickHK
"Arne Hegefors" ...
I have a small macro that produces a floating toolbar. When you select a
chart and then press a button on the toolbar the chart configuration is
set
according to speciments in the code. However I would like to be able to
select many charts and then just press the button. Now i have to do the
same
process for every chart.
My code looks like:
Sub SizeTheChart()
Dim objChart As ChartObject
Dim mySize As Double
With ActiveSheet
ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:="Standard"
With objChart
.Height = 150
.....etc. Please help me how you can refer to multiple charts if possible.
Thank you very much in advance. Any help appreciated!
|