Countdown Clock

J

Johnny Excel

I have a countdown clock in Excel that counts down from 5 min, 10 min, 15
min, 20 min. I need 30 min, 45 min, 60 min, and 90 min added to it. Can
anyone help me?
 
V

Vijay Chary

Hi Johnny !! :)
Open the macro and repeat the appropriate lines of
code to count down from 30, 45, 60 and 90 minutes !! Simple as that !!
 
J

Johnny Excel

Thanks Vijay...I am not real savy with VB, but I got it to work. I figured
out how to copy and paste the code, what I was doing wrong was not assigning
the macro to the button. It works now. Thanks. Just to take it a step
further, I would like when the time ends from the countdown, I would like it
to flash red and/or call up a photo. I have no clue how to code that.
 
V

Vijay Chary

Hi Johnny !! :)
I'm g;ad you could do it .

To make the screen flash red at the end of the
countdown, you
could add these lines to the code.

'*******************Add this piece of code********************
Range("c8:e16").Select

for c = 1 to 10
For a = 1 to 5
Selection.Interior.ColorIndex = n1 ' where n1 = color index for RED
next a
For b = 1 to 5
Selection.Interior.ColorIndex = n2 'where n2 = color index for No
Color
next b
next c
'Record a Macro to set up a hyperlind to the photo that you want to call up
at the
'end of the countdown. Add this piece of code to your Countdown Macro at the
end.

Good Luck !!


Vijay
 
J

Johnny Excel

Hey Vijay, thanks for the response, the color piece is not working:

here is my code for the countdown clock:

Sub StartKlokka()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 1) = 0
Cells(3, 2) = 0
Range("A3").Select
ActiveCell.FormulaR1C1 = "=RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

3 GoTo 1

End Sub

Sub Nedtelling5()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 2) = "00:00:00"
Cells(3, 1) = "00:05:00"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=""00:05:00""-RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

3 GoTo 1

End Sub

Sub Nedtelling10()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 2) = "00:00:00"
Cells(3, 1) = "00:10:00"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=""00:10:00""-RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

3 GoTo 1

End Sub


Sub Nedtelling15()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 2) = "00:00:00"
Cells(3, 1) = "00:15:00"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=""00:15:00""-RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

3 GoTo 1

End Sub

Sub Nedtelling20()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 2) = "00:00:00"
Cells(3, 1) = "00:20:00"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=""00:20:00""-RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

3 GoTo 1

End Sub

Sub Nedtelling30()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 2) = "00:00:00"
Cells(3, 1) = "00:30:00"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=""00:30:00""-RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

3 GoTo 1

End Sub
Sub Nedtelling45()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 2) = "00:00:00"
Cells(3, 1) = "00:45:00"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=""00:45:00""-RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

3 GoTo 1

End Sub
Sub Nedtelling60()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 2) = "00:00:00"
Cells(3, 1) = "01:00:00"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=""01:00:00""-RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

3 GoTo 1

End Sub

Sub Nedtelling90()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 2) = "00:00:00"
Cells(3, 1) = "01:30:00"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=""01:30:00""-RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

3 GoTo 1

End Sub
Sub Nedtelling120()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 2) = "00:00:00"
Cells(3, 1) = "02:00:00"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=""02:00:00""-RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

3 GoTo 1

End Sub

Sub NedtellingTest()
'
' StartKlokka Macro
' Macro recorded 02.05.02 by Oddvar Gorset
'

'

Cells(3, 2) = "00:00:00"
Cells(3, 1) = "00:00:05"
Range("A3").Select
ActiveCell.FormulaR1C1 = "=""00:00:05""-RC[1]"
Starttid = Now()

1 Calculate
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Aktuelltid = Now()
Tid = Aktuelltid - Starttid
Cells(3, 2) = Tid

If Tid < 0 Then GoTo 4
3 GoTo 1

4 End
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top