Thread: time delay
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Incidental Incidental is offline
external usenet poster
 
Posts: 226
Default time delay

Try this

Insert into a new Module

Sub Every5Secs()
Application.OnTime Now + TimeValue("00:00:05"), "add1"
End Sub

Sub add1()
UserForm1.TextBox1 = UserForm1.TextBox1 + 1
If UserForm1.TextBox1 = 100 Then
MsgBox "That's 100"
Exit Sub
End If
Call Every5Secs
End Sub

Create a userform with one textbox leave the names at default insert
this code

Private Sub UserForm_Initialize()
Call Every5Secs
TextBox1 = 1
End Sub

Then run the form

Hope this is of some help

S

KT wrote:
i would like to make a counter in a text field which count automatically from
1 to 100 when load
how can i make a time delay of 0.5sec between each count??