Cycle Through Charts on a Worksheet and Set .Top & .Left for Different Values

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
975
The following code works great for cycling through several charts (with incremental names) to set the height and width...

VBA Code:
For Each sh In Worksheets
    If sh.ChartObjects.Count > 0 Then
        For i2 = 1 To sh.ChartObjects.Count
            sh.ChartObjects(i2).Height = 252
            sh.ChartObjects(i2).Width = 468
        Next i2
    End If
Next sh

I'd like to add something within this block of code (if possible) that allows me to set the .top and .left properties of each one individually.

OR, if that's not possible, is it possible to add something within this block of code to accomplish the same thing? I have one of these blocks for each chart...

Code:
With ActiveChart
    .ChartTitle.Select
    .ChartTitle.Text = "Edit Percentage"
    Selection.Format.TextFrame2.TextRange.Characters.Text = "Edit Percentage" & vbCrLf & res
    
    .Axes(xlCategory).AxisTitle.Select
    .Axes(xlCategory, xlPrimary).AxisTitle.Text = "Location"
    Selection.Format.TextFrame2.TextRange.Characters.Text = "Venue" & vbCrLf & sChartTitle2
    
    '.FullSeriesCollection(1).XValues = "='7DayEdits'!$A$2:$A$55"
    .FullSeriesCollection(1).XValues = ActiveWorkbook.ActiveSheet.Range(Cells(1, 1), Cells(1, 1).End(xlDown))
    .Axes(xlCategory).Select
    Selection.TickLabels.Orientation = xlUpward
End With

Thanks in advance.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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
Back
Top