A macro to reset cells, starting a countdown timer and counting how many times another macro runs

AceCo55

New Member
Joined
Aug 28, 2015
Messages
24
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!

  1. 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]
(somehow everything I have tried using a “call” command has the countdown timer just down in blocks of seconds so what should be a one minute timer is over in about 15 seconds!)


  1. 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


  1. I would also like to have a running count, in J14, of how many sets have been completed
ie it needs to count each time the “Roll Again” button/macro is run.(the class wins if they can complete 10 sets in one minute!)
[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]
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,214,965
Messages
6,122,496
Members
449,089
Latest member
Raviguru

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
Back
Top