I have run into problems using macros to control some actions in the “Rainbow Fact Challenge” worksheet.
https://www.dropbox.com/s/8moydblnshrfm08/Beat the clock_ver 2.0.0.xlsm?dl=0
I do not know how to code in vba. All my macros I have ever used are either recordings or cut and paste from existing code.
In this sheet, auto-calculation has been turned off
K2 - The teacher selects the number of dice to be used
M2 - The teacher selects how long the challenge will go for – I want it to be 1 minute unless the teacher selects another time (this list comes from a named range “Timer_list” (in column R)
The sheet has a macro that counts down the time in D14
This is the code that I copied from the internet:
Dim gCount As Date
'Updateby20140925
Sub Timer()
gCount = Now + TimeValue("00:00:01")
Application.OnTime gCount, "ResetTime"
End Sub
Sub ResetTime()
Dim xRng As Range
Set xRng = Application.ActiveSheet.Range("D14")
xRng.Value = xRng.Value - TimeSerial(0, 0, 1)
If xRng.Value <= 0 Then
MsgBox "Countdown complete."
Exit Sub
End If
Call Timer
End Sub
Now the problems!
[h=1]I will be hiding column R, protecting the worksheet and turning off headings, gridlines and formula bar
[/h][h=1](if that is of any consequence to a macro)[/h][h=1]Thank you for any help you might be able to provide.[/h]
https://www.dropbox.com/s/8moydblnshrfm08/Beat the clock_ver 2.0.0.xlsm?dl=0
I do not know how to code in vba. All my macros I have ever used are either recordings or cut and paste from existing code.
In this sheet, auto-calculation has been turned off
K2 - The teacher selects the number of dice to be used
M2 - The teacher selects how long the challenge will go for – I want it to be 1 minute unless the teacher selects another time (this list comes from a named range “Timer_list” (in column R)
The sheet has a macro that counts down the time in D14
This is the code that I copied from the internet:
Dim gCount As Date
'Updateby20140925
Sub Timer()
gCount = Now + TimeValue("00:00:01")
Application.OnTime gCount, "ResetTime"
End Sub
Sub ResetTime()
Dim xRng As Range
Set xRng = Application.ActiveSheet.Range("D14")
xRng.Value = xRng.Value - TimeSerial(0, 0, 1)
If xRng.Value <= 0 Then
MsgBox "Countdown complete."
Exit Sub
End If
Call Timer
End Sub
Now the problems!
- I would like the START button to do the following
- [h=4]¨ first does a manual recalculation[/h]
- [h=4]¨resets the timer in D14 to whatever is selected in M2[/h]
- [h=4]¨resets the counter in J14 to zero[/h]
- [h=4]¨starts the clock[/h]
- The “Roll Again” button just does a manual recalculation (so that a new set of numbers appears in the boxes in row 11). The teacher needs to click this each time a student gives the correct answers to the boxes in Row 11
This is working
- I would also like to have a running count, in J14, of how many sets have been completed
[h=1]I will be hiding column R, protecting the worksheet and turning off headings, gridlines and formula bar
[/h][h=1](if that is of any consequence to a macro)[/h][h=1]Thank you for any help you might be able to provide.[/h]