kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
When i pasted and ran the code only the 8 appeared. Maybe i did something wrongly
Does this script install all the Buttons?
It appears as if there are:
One Spin Button
Two Command Buttons
Two Option Buttons
These look like Form Controls: True ?
When i pasted and ran the code only the 8 appeared. Maybe i did something wrongly
i = 2 'set as increment number for each new digit
Option Explicit
Dim stopTimer As Boolean
Dim n As Integer
Private Sub StartBtn_Click()
Dim Start
Dim msec As Integer, sec As Integer, sec2 As Integer
stopTimer = False
For n = 1 To 1
NumberON m:=0, n:=n
Next n
Start = Timer ' Set start time.
Do While Timer < Start + 100 'set this number to limit the time the clock will run
DoEvents ' Yield to other processes.
If stopTimer = True Then Exit Do
msec = ((Timer * 10) Mod (Start * 10))
If msec = 10 Then
Start = Timer
msec = 0
End If
NumberON m:=msec, n:=1
Loop
End Sub
Private Sub StopBtn_Click()
stopTimer = True
End Sub
You did it correctly. Now add at least 2 command buttons, "StartBtn" & "StopBtn"...
CJ
Hello MrIfOnly,
I ran the LED DISPLAY you sent me and i really liked it. But the timer can it run till i stop it? Because it stops after sometime then i have to start it again.
Thanks and regards.
If sec2 = 10 Then Exit Sub
If sec2 = 10 Then
msec = 0
sec = 0
sec2 = 0
End If
Okay thanks. I want to get it to my project so that it will start running whenever i open my workbook.
Dim stopTimer As Boolean
Public stopTimer As Boolean
Private Sub Workbook_Open()
Application.WindowState = xlMaximized
Dim Start
Dim msec As Integer, sec As Integer, sec2 As Integer, n As Integer
stopTimer = False
With Worksheets("Counter")
.Activate
.Shapes("POINT").Fill.Transparency = 0
For n = 1 To 3 'set this to the number of digits
NumberON m:=0, n:=n
Next n
DoEvents
Start = Timer ' Set start time.
Do While Timer < Start + 100 'set this number to limit the time the clock will run
DoEvents ' Yield to other processes.
If stopTimer = True Then Exit Do
msec = ((Timer * 10) Mod (Start * 10))
If msec = 10 Then
sec = sec + 1
If sec = 10 Then
sec2 = sec2 + 1
If sec2 = 10 Then
msec = 0
sec = 0
sec2 = 0
End If
NumberON m:=sec2, n:=3
sec = 0
End If
Start = Timer
With .Shapes("POINT").Glow
.Color = RGB(255, 0, 0)
.Radius = IIf(.Radius = 0, 5, 0)
.Transparency = 0.5
End With
NumberON m:=sec, n:=2
msec = 0
End If
NumberON m:=msec, n:=1
Loop
With .Shapes("POINT").Glow
.Color = RGB(255, 0, 0)
.Radius = IIf(.Radius = 0, 5, 0)
.Transparency = 1
End With
End With
End Sub