LED Display Anyone?

When i pasted and ran the code only the 8 appeared. Maybe i did something wrongly
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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 ?

The script does not install the buttons. They are all ActiveX controls. I used 4 command buttons (StartBtn, StopBtn, On & Off. Although, now that you mention it, option buttons would have been better for the On and Off.
 
Thanks.

When I make a Activex Spin button it does not look like yours.

Now if I make a Form Control Spin Button it looks like yours.
Using Excel 2013
 
When i pasted and ran the code only the 8 appeared. Maybe i did something wrongly

You did it correctly. Now add at least 2 command buttons, "StartBtn" & "StopBtn". If you run the "newNumber" macro again, change the increment number each time you re-run it:

Code:
i = 2 'set as increment number for each new digit

It will create new numbers on new sheets. Select the shapes, right click, select group, then copy & paste the new numbers into the original sheet with the command buttons.

The code is currently setup for 3 digits and a rectangle shape called "POINT" (you'll have to draw this in yourself if you want it).

Sorry I didn't make this more plug n' play. To make it simpler, here is the code for just running a single digit with no point and only the Start and Stop buttons:

Code:
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

CJ
 
Last edited:
You can also PM your e-mail address and I can send the file to you if you'd like.
 
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.
 
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.

Hi Kelly,

Yes, it is currently programmed to run up to 99.9 seconds, but you can modify the code as follows to allow for continuous running:

Replace:

Code:
If sec2 = 10 Then Exit Sub

in the StartBtn click event code with:

Code:
                If sec2 = 10 Then
                    msec = 0
                    sec = 0
                    sec2 = 0
                End If

Regards,

CJ
 
Okay thanks. I want to get it to my project so that it will start running whenever i open my workbook.
 
Okay thanks. I want to get it to my project so that it will start running whenever i open my workbook.


Kelly,

In order to do this, follow the steps below:

1) Delete this line from the worksheet module:
Code:
Dim stopTimer As Boolean

2) Add this line to your declarations at the top of your standard module:
Code:
Public stopTimer As Boolean

3) Paste this code to your ThisWorkbook module (this assumes you still have the sheet named "Counter" with the digits on it):
Code:
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

Regards,

CJ
 

Forum statistics

Threads
1,224,829
Messages
6,181,222
Members
453,024
Latest member
Wingit77

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
Back
Top