#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Animation

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Animation

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


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
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


.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Animation

I used Sheet1 as the object

Set logo = Worksheets("Sheet1").Shapes(1)
and
Set logo = Sheet1.Shapes(1)

are synonymous.
In this case sheet1 is the object name while "sheet1" is
also the sheet's name. Look in the project explorer &
you'll see what I mean if you select sheet1 and look at
its properties.

Patrick Molloy
Microsoft Excel MVP



-----Original Message-----
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


.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cell animation macismom Excel Discussion (Misc queries) 1 May 17th 07 11:12 PM
animation in excel Jim Excel Worksheet Functions 1 March 5th 07 08:57 PM
If it's possible to use animation in Excel? Slava Excel Discussion (Misc queries) 0 January 30th 06 10:19 AM
Animation Weave New Users to Excel 1 December 7th 05 02:21 PM
animation Adam Klee Excel Programming 0 August 12th 03 08:04 AM


All times are GMT +1. The time now is 06:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"