Make Macro run slower

takformaten

Board Regular
Joined
Jan 19, 2004
Messages
75
Hi everyone!

I nearly got it done! the macro is up and running, now I want to enable the users to actually see, what the macro is doing (select this cell, copy it to there and so on...) by reducing the macro speed...

Is there any way to do this?

Regards

tak
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
This code delays the macro for 2 seconds :-
Application.Wait Now + TimeValue("00:00:02")
 

takformaten

Board Regular
Joined
Jan 19, 2004
Messages
75
Thanks a lot for your help, yet that was not the answer to my problem unfortunaltely. I guess I didn't make my point clear.

The macro I have makes textboxes move on the sheet, photos appear and disappear, data gets copied and pasted... just like in an animation, that'S how one could describe it best probably.

Macro is up and running as I said, yet far toooo fast for the eye to see... Your code makes my macro start later, I want it to perform slower, so that the user actually can follow what is happening.

Sorry again for the lack of detail!

And: PLEASE HELP !!!

Tak
 

Noir

Active Member
Joined
Mar 24, 2002
Messages
362
Hi Tak,
Probably not exactly what you are looking for but, might spark new ideas to help solve your problem. (This method works perfectly for me).

I wanted a visual animation for my progress indicator (instead of the old bar type). As my macro downloads data, my little animation runs slowly enough to see everything.

I have a series of Character Map symbols on my sheet. The symbols are, 5-buildings, 1-mountain,1-sun, *1-airplane and 6-flames hidden by white font*). I use the following counter code to give the illusion that the airplane is swooping down (right to left) over the buildings and setting fire to each building one by one.

Private Sub CommandButton1_Click()
Count = 0
Do Until Count = 100
Count = Count + 1
[A1].Value = Count
Loop
MsgBox "Press OK to continue"
Range("A1").Select
ActiveCell.FormulaR1C1 = "0"
End Sub

When i push the CommnadButton this code starts. I have =IF(OR formulas on my sheet and Conditional Formatting (to add color) that will make the airplane appear in cell A20 when A1's value is between 1-10. Between, 11-20, the airplane appears in cell A21, 21-30, cell A22 and so on until 100. In this case i chose to use sheet level =IF(OR formulas. You may choose to stay completely with VBA. My point is you may be able to have your macros fire at staggered times by using the counter code. You may want to consider using the Private Sub Worksheet_Calculate event and add multiple statements such as; If [A1].Value = 1 Then..... to fire your macros when the code reaches certain values thus separating each action.

HTH
Good luck!

Noir
 

just_jon

Legend
Joined
Sep 3, 2002
Messages
10,473
I think you misunderstood BrianB'S suggestion and put the code only at the top of your macro -- you need to insert that statement every time you wish the code delayed, as below A15 is immediately filled, followed by a 10-second "sleep" before cell B15 is filled. Repeat/modify timing as needed.

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> foo()
[a15] = "aaa"
Application.Wait Now + TimeValue("00:00:10")
[b15] = "xxx"
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 

takformaten

Board Regular
Joined
Jan 19, 2004
Messages
75
OK, OK, OK...

I had -my mistake- misunderstood, what BrianB suggested.

After all I got it running...

Cheers for having patience with me...

Tak
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,883
Messages
5,766,911
Members
425,385
Latest member
djkevnic

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
Top