1Big_Daddy
New Member
- Joined
- Jul 25, 2007
- Messages
- 5
Is it possible to write code that would make a commandbutton flash to draw the user's attention?
Sub Flashy()
With ActiveSheet.CommandButton1
For n = 1 To 5
.BackColor = &HC0C0FF 'pink
DoEvents
Application.Wait Now + TimeValue("00:00:01") ' 1 second
.BackColor = &HC0C0C0 'grey
DoEvents
Application.Wait Now + TimeValue("00:00:01") ' 1 second
Next
End With
End Sub
Try this. If you want delays of less than 1 second have a look at the API Sleep function.
Code:Sub Flashy() With ActiveSheet.CommandButton1 For n = 1 To 5 .BackColor = &HC0C0FF 'pink DoEvents Application.Wait Now + TimeValue("00:00:01") ' 1 second .BackColor = &HC0C0C0 'grey DoEvents Application.Wait Now + TimeValue("00:00:01") ' 1 second Next End With End Sub