VBA bring forward issue

posfog

Board Regular
Joined
Jun 2, 2009
Messages
171
Hi All,
I have the following code which i am using multiple times within the same sheet to enlarge graphs.(where i have highlighted red the code would change for the different graphs and their small location)

Sub AccidentVsCaseRate()


Dim ws As Worksheet
Dim chto As ChartObject
Dim rSmall As Range, rBig As Range
Static b As Boolean
Set chto = Worksheets("Dashboard").ChartObjects(1)
Set rSmall = Worksheets("Dashboard").Range("B6:H14")
Set rBig = Worksheets("Dashboard").Range("B6:X35")


If b Then
chto.Width = rSmall.Width
chto.Height = rSmall.Height
chto.Left = rSmall.Left
chto.Top = rSmall.Top
Else
chto.Width = rBig.Width
chto.Height = rBig.Height
chto.Left = rBig.Left
chto.Top = rBig.Top

End If
b = Not b
End Sub

My issue is when i click on on graph some of the others still show over the top of the graph, How can the above coding be changed so no matter which graph is enlarged the selected graph is show in full detail without nothing being over the top of it.

Regards
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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