selecting shapes in a chart

Bearded Cyclops

New Member
Joined
Oct 27, 2002
Messages
1
HI,
I'm working on a subroutine of larger piece of code that creates graphs for several diferent offices in my company. The following code is the section i'm struggling with.

Sub create_charts() 'create charts from the pivot tables

For x = 1 To noo ' number of offices
cur_office = Worksheets("control").Range("A" & (4 + x))
Worksheets(cur_office).Select

Range("A2").Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets(cur_office).Range("F11")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "=" & cur_office & "!R4C3:R" & (3 + month) & "C3"
ActiveChart.SeriesCollection(1).Values = "=" & cur_office & "!R4C2:R" & (3 + month) & "C2"
ActiveChart.SeriesCollection(1).Name = "=""Sales NN"""
ActiveChart.SeriesCollection(2).XValues = "=" & cur_office & "!R4C3:R" & (3 + month) & "C3"
ActiveChart.SeriesCollection(2).Values = "=" & cur_office & "!R" & (4 + month) & "C2:R" & (3 + month + month) & "C2"
ActiveChart.SeriesCollection(2).Name = "=""Sales Target NN"""
ActiveChart.SeriesCollection(3).XValues = "=" & cur_office & "!R4C3:R" & (3 + month) & "C3"
ActiveChart.SeriesCollection(3).Values = "=" & cur_office & "!R" & (4 + month + month) & "C2:R" & (3 + month + month + month) & "C2"
ActiveChart.SeriesCollection(3).Name = "=""Orders Booked NN"""
ActiveChart.Location Where:=xlLocationAsObject, Name:=cur_office
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Characters.Text = "Change This Title in CODE"
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = True
ActiveChart.DataTable.ShowLegendKey = True
ActiveChart.ChartArea.Select
Selection.AutoScaleFont = False
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 12
End With
ActiveSheet.DrawingObjects.Placement = xlMove
ActiveSheet.DrawingObjects.PrintObject = True

**********************************
NEED HELP HERE
**********************************

With ActiveSheet.Charts(cur_office).Shape '*****this is wrong
.IncrementLeft -183#
.IncrementTop -85
.ScaleWidth 1.78, msoFalse, msoScaleFromTopLeft
.ScaleHeight 1.88, msoFalse, msoScaleFromTopLeft
End With
Next x

End Sub

I've noted the section I need help with. How do I select the shapes in the chart so I can move them? Is there a way to rename a shape?
Hope this is not tomuch to ask. Thanks!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,144,360
Messages
5,723,902
Members
422,525
Latest member
dsenff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top