PDA

View Full Version : Timer/StopWatch - How do I make button turn to red and flash when I click Start?



yeto
12-08-2018, 05:10 AM
The way my code works now is that the Start and Stop button is one in the same. The button is green. What I would like to happen is that when I click Start and the button changes to Stop I would also like for the color to change to red and to flash.


Sub startStopTimer()
If Range("timer.button.label") = "Start" Then
Range("time.stamp.start").Offset(Range("count.of.timestamps") + 1).Value = Now
Range("timer.button.label") = "Stop"
Else
Range("time.stamp.start").Offset(Range("count.of.timestamps"), 1).Value = Now - Range("time.stamp.start").Offset(Range("count.of.timestamps"))
Range("timer.button.label") = "Start"
End If
End Sub


Thank you in advance for any help,
yeto

yeto
12-08-2018, 06:19 PM
The way my code works now is that the Start and Stop button is one in the same. The button is green. What I would like to happen is that when I click Start and the button changes to Stop I would also like for the color to change to red and to flash.


Sub startStopTimer()
If Range("timer.button.label") = "Start" Then
Range("time.stamp.start").Offset(Range("count.of.timestamps") + 1).Value = Now
Range("timer.button.label") = "Stop"
Else
Range("time.stamp.start").Offset(Range("count.of.timestamps"), 1).Value = Now - Range("time.stamp.start").Offset(Range("count.of.timestamps"))
Range("timer.button.label") = "Start"
End If
End Sub



The below is a link to the timer which I use and the page includes a link to download the worksheet/spreadsheet if needed.

https://chandoo.org/wp/building-a-simple-timer-using-excel-vba-to-track-my-rubiks-cube-solving-speed-case-study/

Thank you in advance for any help,
yeto

yeto
12-10-2018, 10:39 AM
I have posted this question in a different forum. Please still help if you can.

https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/1212749-how-make-a-timer-stopwatch-start-button-change-color-and-blink-when-first-clicked

大灰狼1976
12-10-2018, 10:18 PM
Hi yeto!
For a simple example, Please refer to the attachment.

yeto
12-12-2018, 03:52 AM
Hi yeto!
For a simple example, Please refer to the attachment.

Thank you for taking time to help. This will be very helpful.