Flashing label.backcolor with Do Until / loop trouble

Horspool68

New Member
Joined
Jul 24, 2015
Messages
3
Hi All ! just wrote this macro

Private Sub CommandButton1_Click()
Label1.BackColor = &HFF&
Application.Wait (Now + TimeValue("00:00:01"))
Label1.BackColor = &H8000000F
Application.Wait (Now + TimeValue("00:00:01"))
Do Until OptionButton11.Value = True
Loop
End Sub

I would like to use this on an excel file used to record production Data ( OEE ) on pressing the downtime button I would like Label1 backcolor flash from grey to red until the option button is activated. When I run this the label changers color and then my excel freezes up , is this a computer spec issue or am I missing something?:mad:
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
try the below

Code:
Private Sub CommandButton1_Click()

My_wait_time = 1 '1 Second


    Do Until ActiveSheet.OptionButton11.Value = True
 
        ActiveSheet.Label1.BackColor = &HFF&
        
            Wait My_wait_time
        
        ActiveSheet.Label1.BackColor = &H8000000F
        
            Wait My_wait_time

    Loop


 End Sub
 
 Private Sub Wait(ByVal nSec As Long)
    nSec = nSec + Timer
    While nSec > Timer
        DoEvents
    Wend
End Sub
 
Upvote 0
Thanks! its so easy to see the mistake when someone else gives the answer
again thanks! have a great weekend.:)
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,871
Members
449,055
Latest member
excelhelp12345

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