Thread: Animation
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Adam Klee Adam Klee is offline
external usenet poster
 
Posts: 8
Default Animation

Many thanks it's working but Iwould have to put one element mo
Sub Animation()
Dim logo As Shape
Dim y As Single, x As Single
Set logo = Worksheets("Sheet1").Shapes(1)
For y = 1 To 16 Step 2
logo.Width = y
For x = 1 To 8 Step 1
logo.Height = x
DoEvents
Next x
Next y
End Sub


Uzytkownik "Patrick Molloy" napisal w wiadomosci
...
you'd see the for..next more clearly if you "nested" as
per the code below:

Sub Animation()
Dim logo As Shape
Dim y As Single, x As Single
Set logo = Sheet1.Shapes(1)
For y = 1 To 16 Step 2
logo.Width = y
For x = 1 To 8 Step 1
logo.Height = x
DoEvents
Next x
Next y
End Sub


Mote that it isn't necessary for the variable to be
placed after the 'next' instruction, so
Next
Next
is OK, but for clarity, I think the variables ought to be
there.



Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
At first sorry for my incorrect english, but it isn'my

main language.
As a matter of fact I'm a beginer of VBA, but I decided

to try.
I have a small problem, how can I make a macro to resize

simple rectangle on
the worksheet (after clicking).
Resizing will have to be animated of course.
I' thinking that I have used wrong prperty?

Sub Animation()
Dim logo As Shape
Dim y As Single, x As Single
For y = 1 To 16 Step 2
logo.ShapeRange.ScaleWidth = x
For x = 1 To 8 Step 1
logo.ShapeRange.ScaleHeight = y
DoEvents
Next y
Next x
End Sub


.