Hi All,
I have the following code that enlarges and reduces the size of a named chart
But I wondered if the coding can be changed so it also does the same to another chart at the same time but with the following sizes etc
So when i click on the chart attached to the macro then both charts open or reduce at the same time.
Kind Regards
I have the following code that enlarges and reduces the size of a named chart
Code:
Sub AccidentBodyPartTrend1()
Dim ws As Worksheet
Dim chto As ChartObject
Dim rSmall As Range, rBig As Range
Static b As Boolean
Set chto = Worksheets("Dashboard").ChartObjects("Bodybarall")
Set rSmall = Worksheets("Dashboard").Range("AF7:AJ15")
Set rBig = Worksheets("Dashboard").Range("B5:Q35")
If b Then
chto.BringToFront
chto.Width = rSmall.Width
chto.Height = rSmall.Height
chto.Left = rSmall.Left
chto.Top = rSmall.Top
Else
chto.BringToFront
chto.Width = rBig.Width
chto.Height = rBig.Height
chto.Left = rBig.Left
chto.Top = rBig.Top
End If
b = Not b
End Sub
But I wondered if the coding can be changed so it also does the same to another chart at the same time but with the following sizes etc
Code:
Set chto = Worksheets("Dashboard").ChartObjects("Bodypieall")
Set rSmall = Worksheets("Dashboard").Range("AK7:AN15")
Set rBig = Worksheets("Dashboard").Range("R5:AN35")
So when i click on the chart attached to the macro then both charts open or reduce at the same time.
Kind Regards
Last edited by a moderator: