I have developed a darts scoreboard which allows me to, in a basic way, enter scores in certain boxes and reduce the overall score until it reaches 0.
Along the way, certain stats are collected and displayed, both from within the current game and the overall match.
I have a button which allows a new game to be set up (resets game stats) and a new match (resets game and match stats).
I want to be able to add a bit of code to my new game button, which basically looks to see if the current game has been finished, and if it hasn't then it resets the stats to what they were at the start of the game.
This is currently the piece of code which works fine in terms of collecting the scores and reporting on them:
'if checkout
If Range("D12") = 0 Then
'input formula to get checkout (Will reflect any change if error)
Cells(Range("E59").Value, Target.Column - 2).FormulaR1C1 = "=RC[-1]"
End If
If Range("P12") = 0 Then
'input formula to get checkout (Will reflect any change if error)
Cells(Range("Q59").Value, Target.Column - 2).FormulaR1C1 = "=RC[-1]"
End If
'Add match score to E59 and Q59 downwards
Select Case Target.Column
Case 7 'Player 1
Cells(Range("E59").Value, Target.Column - 3) = Target.Value
Case 19 'Player 2
Cells(Range("Q59").Value, Target.Column - 3) = Target.Value
End Select
Essentially what this does is looks at the score entered in the field higher up and copies it into the next appropriate cell in column E or Q. If a player reaches 0, then the checkout (i.e. their final score that made the game finish is also copied into columns F or R. From this, I can then work out all the stats.
How would I go about adding a bit of code that essentially looks to see if the game is in progress and if so only deletes the scores relevant for that particular game?
Hope this makes sense, but I can upload the spreadsheet somewhere if required.
Bookmarks