0

I have two Command Buttons like these:

Private Sub CommandButton1_Click()
CommandButton1.BackColor = vbRed
Application.Wait (Now + TimeValue("00:00:15"))
CommandButton1.BackColor = vbYellow
End Sub
'______________________________________________
Private Sub CommandButton2_Click()
CommandButton2.BackColor = vbBlue
End Sub

I'd like to run CommandButton2 while CommandButton1 is running.

does anyone have any ideas?

1 Answers1

0

Try this ...

Private Sub CommandButton1_Click()
    CommandButton1.BackColor = vbRed
    For X=1 to 15
        Application.Wait (Now + TimeValue("00:00:01"))
        DoEvents
    Next X
    CommandButton1.BackColor = vbYellow
End Sub

Your app will be more responsive if you can wait, say, 100 milliseconds each time, rather than 1 second.