View Full Version : [SOLVED:] Zooming in and out of a graph
keilah
08-22-2007, 04:41 AM
i need to amend it......so only the graph with the micro button zoom out by say 1.5....and not to make the rest of the cells in the worksheet also in large by "say" 1.5....this to remain its normal size
only just the graph
here is the code
Sub Macro1()
intOrigZoom = ActiveWindow.Zoom
ActiveWindow.Zoom = intOrigZoom * 1.5
MsgBox "Click to close window 1.5"
ActiveWindow.Zoom = intOrigZoom
End Sub
p45cal
08-22-2007, 05:54 AM
Something on the lines of:
Sub blah()
myWidth = ActiveSheet.Shapes("Chart 1").Width
myHeight = ActiveSheet.Shapes("Chart 1").Height
ActiveSheet.Shapes("Chart 1").ScaleWidth 1.5, msoFalse, msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 1").ScaleHeight 1.5, msoFalse, msoScaleFromTopLeft
DoEvents
MsgBox "Pause"
ActiveSheet.Shapes("Chart 1").Width = myWidth
ActiveSheet.Shapes("Chart 1").Height = myHeight
End Sub
a button dragged onto the chart from the Forms toolbar, then assigned to the above macro worked.
keilah
08-22-2007, 06:57 AM
How do you centre the graph and bring it back to its origianl location ....using the above code
p45cal
08-22-2007, 08:25 AM
Sub blah()
myWidth = ActiveSheet.Shapes("Chart 1").Width
myHeight = ActiveSheet.Shapes("Chart 1").Height
ActiveSheet.Shapes("Chart 1").ScaleWidth 1.5, msoFalse, msoScaleFromMiddle
ActiveSheet.Shapes("Chart 1").ScaleHeight 1.5, msoFalse, msoScaleFromMiddle
DoEvents
MsgBox "Pause"
ActiveSheet.Shapes("Chart 1").ScaleWidth 1 / 1.5, msoFalse, msoScaleFromMiddle
ActiveSheet.Shapes("Chart 1").ScaleHeight 1 / 1.5, msoFalse, msoScaleFromMiddle
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.