PDA

View Full Version : [SOLVED] Back to it original location



keilah
08-23-2007, 01:19 AM
Hi Got the following code from this site yesterday.....

It does everything BUT........re postion the graph back to its starting point......

How do i get it to go back to it starting point........

here is the code...



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

Bob Phillips
08-23-2007, 01:26 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
End Sub


You should really learn about adding VBA tags to your code.

keilah
08-23-2007, 01:34 AM
Hi XLD

i think i made a mistake in my explaination.....i need the graph to be centred.....on clicking the msgbox button in the original VBA code i posted,,,,,,,,then go back to its original postions....

meaning not to resize back and stay in the center of the screen........

back to say column b row 250....its starting point.....

Bob Phillips
08-23-2007, 01:59 AM
So do you need it resized?

keilah
08-23-2007, 02:04 AM
hi mate

Yes... to your question.....just having a bad day..............sorry for all the badly word explainations.

And back to where every it was before it went to the center of the screen,,,,,,,,,

Bob Phillips
08-23-2007, 02:06 AM
No worries, just want to be clear so that we can solve it as quickly as possible


Sub blah()
With ActiveSheet.Shapes("Chart 1")
myleft = .Left
mytop = .Top
.ScaleWidth 1.5, msoFalse, msoScaleFromMiddle
.ScaleHeight 1.5, msoFalse, msoScaleFromMiddle
.Left = myleft
.Top = mytop
End With
End Sub