Flashing commandbutton...

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?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
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
 

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,432
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Resurrecting this post ...
This is a great start to what I'm looking for. Is anyone able to modify this to best go about having this commandbutton (on my userform) continue to blink until it's pressed?
 

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,432
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
For my own personal use I don't think I need to worry about that, but thank you for your concern.
 

dmt32

Well-known Member
Joined
Jul 3, 2012
Messages
7,796
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
Hi Joe4,
Just curious – this is a very old thread – as a MOD are you aware of any forum rule about thread “hijacking”? Not suggesting OP has done anything wrong just wondering how MrExcel views such activity?

Dave
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
66,097
Office Version
  1. 365
Platform
  1. Windows
The forum rules can be found here: https://www.mrexcel.com/forum/board-announcements/99490-forum-rules.html
See rule #9 for the best way of handling these type of concerns.

I would not call this thread hijacking for two reasons:
- The thread has been dormant for 10 years
- The question was directly related to the replies

Thread hijacking is more commonly defined when someone posts their own question to an active thread, and the question quite often is very different from the question being asked.

That being said, I would recommend users post their questions to new threads instead of posting to old threads for the following reasons.
- Since the question already has replies, it will not show up on the "Zero Reply Posts" listing that many people go to in order to look for new unanswered questions, so it will get passed over by many potential helpers.
- Sometimes the users involved in the original thread are not that active on the forum anymore, so they might not see the question.

My recommendation would be to start a new thread, and include a link to this other thread, if it is helpful in explaining your issue. However, you typically only want to post the question once, as we do have rules against duplicate postings! So you need to pick one or the other.
 

dmt32

Well-known Member
Joined
Jul 3, 2012
Messages
7,796
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
Hi,
I had a feeling that you would point out rule 9 but as said, did not think OP was doing anything wrong and also, going rule 9 route, others would not see the response which they may find useful.

I know another forums get quite animated with members stepping in to another’s thread but MrExcel (thankfully) less so but there does not seem to be much guidance in this area perhaps your very helpful response could be added to posting notes?

Many Thanks.

Dave
 

De Bruce

New Member
Joined
May 23, 2019
Messages
30
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

Please, how can I achieve this on a userform with command button I want to blink.
 

Forum statistics

Threads
1,181,421
Messages
5,929,805
Members
436,696
Latest member
Mr Rice

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
Top