Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anyone tell me how to slow down macro or choose how
fast a macro runs. If you have a macro with screen updating turned on I want it to slow down enough to view the date being entered. Any ideas on this. Pete |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Pete
not something people are usually looking for. Try something like this: Sub SlowDownTest() Range("A1") = "a" SlowDownLoop Range("B1") = "b" SlowDownLoop Range("C1") = "c" SlowDownLoop Range("D1") = "d" SlowDownLoop Range("E1") = "e" SlowDownLoop End Sub Private Sub SlowDownLoop() Const LoopCount = 10000000 Dim i As Long For i = 1 To LoopCount Next i End Sub Vary the value of LoopCount to match your needs. You might need to add a zero or double the value, etc. Regards Trevor "Pete" wrote in message ... Can anyone tell me how to slow down macro or choose how fast a macro runs. If you have a macro with screen updating turned on I want it to slow down enough to view the date being entered. Any ideas on this. Pete |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Pete,
Another way from mskb 162150 ... Use an API call to suspend execution for a fixed amount of time. The Kernel32 contains a function that pauses a program's execution for a specified amount of time, specified in milliseconds. To use the function, it must first be declared in the General Declarations section of the module in which it will be used: '-------------------------------------------------- Declare Sub Sleep Lib "kernel32" Alias "Sleep" _ (ByVal dwMilliseconds As Long) 'Use the following syntax to call the Sleep function: Sub Sleep() Sleep 1000 'Implements a 1 second delay End Sub '-------------------------------------------------- Regards, Jim Cone San Francisco, CA "Pete" wrote in message ... Can anyone tell me how to slow down macro or choose how fast a macro runs. If you have a macro with screen updating turned on I want it to slow down enough to view the date being entered. Any ideas on this. Pete |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Trevor
I can't get the second option you suggested to work properly without running in a massive continous loop. here is my code below, can you get to work? What i want to see is where the words "No Match are insert in my first range. But I don't want it to fly by soo fast that the user can't reconize it. Application.ScreenUpdating = True Set MyFirstRange = Range("z3:z220") Set MySecondRange = Range("b3:b220") fnd = 0 For Each c In MyFirstRange For Each n In MySecondRange If c.Value = n.Value Then c.Offset(0, 4).Value = n.Offset(0, 4).Value fnd = 1 End If Next If fnd = 0 Then c.Offset(0, 4).Value = "No Match" fnd = 0 Next Thanks Pete -----Original Message----- Pete not something people are usually looking for. Try something like this: Sub SlowDownTest() Range("A1") = "a" SlowDownLoop Range("B1") = "b" SlowDownLoop Range("C1") = "c" SlowDownLoop Range("D1") = "d" SlowDownLoop Range("E1") = "e" SlowDownLoop End Sub Private Sub SlowDownLoop() Const LoopCount = 10000000 Dim i As Long For i = 1 To LoopCount Next i End Sub Vary the value of LoopCount to match your needs. You might need to add a zero or double the value, etc. Regards Trevor "Pete" wrote in message ... Can anyone tell me how to slow down macro or choose how fast a macro runs. If you have a macro with screen updating turned on I want it to slow down enough to view the date being entered. Any ideas on this. Pete . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure I understand "second option". The first piece of code simply
demonstrates the SlowDownLoop subroutine. In your example, I think you need to put the call to the subroutine as shown. For Each c In MyFirstRange For Each n In MySecondRange If c.Value = n.Value Then c.Offset(0, 4).Value = n.Offset(0, 4).Value fnd = 1 End If Next If fnd = 0 Then c.Offset(0, 4).Value = "No Match" SlowDownLoop End If fnd = 0 Next Regards Trevor wrote in message ... Trevor I can't get the second option you suggested to work properly without running in a massive continous loop. here is my code below, can you get to work? What i want to see is where the words "No Match are insert in my first range. But I don't want it to fly by soo fast that the user can't reconize it. Application.ScreenUpdating = True Set MyFirstRange = Range("z3:z220") Set MySecondRange = Range("b3:b220") fnd = 0 For Each c In MyFirstRange For Each n In MySecondRange If c.Value = n.Value Then c.Offset(0, 4).Value = n.Offset(0, 4).Value fnd = 1 End If Next If fnd = 0 Then c.Offset(0, 4).Value = "No Match" fnd = 0 Next Thanks Pete -----Original Message----- Pete not something people are usually looking for. Try something like this: Sub SlowDownTest() Range("A1") = "a" SlowDownLoop Range("B1") = "b" SlowDownLoop Range("C1") = "c" SlowDownLoop Range("D1") = "d" SlowDownLoop Range("E1") = "e" SlowDownLoop End Sub Private Sub SlowDownLoop() Const LoopCount = 10000000 Dim i As Long For i = 1 To LoopCount Next i End Sub Vary the value of LoopCount to match your needs. You might need to add a zero or double the value, etc. Regards Trevor "Pete" wrote in message ... Can anyone tell me how to slow down macro or choose how fast a macro runs. If you have a macro with screen updating turned on I want it to slow down enough to view the date being entered. Any ideas on this. Pete . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm surprised nobody has suggested this yet, but have a
look at the Wait method in your Excel Help. -----Original Message----- Can anyone tell me how to slow down macro or choose how fast a macro runs. If you have a macro with screen updating turned on I want it to slow down enough to view the date being entered. Any ideas on this. Pete . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Slow Tab | Excel Discussion (Misc queries) | |||
Slow Excel Navigation with Up / Down Arrow and slow scrolling | Excel Discussion (Misc queries) | |||
Why Del is Slow | Excel Discussion (Misc queries) | |||
Why so slow | Excel Discussion (Misc queries) | |||
Slow Down... | Excel Programming |