Button to clear values and keep running total

D

dwalsh77

I have created a worksheet to keep track of the scores and totals fo
playing a Dart game.
Basically, I need to know if there is a way that I could create
button that would clear the scores (once the game is over), AND keep
running average 3 dart average after each game is played.

Thanks for any help
 
C

Chris Leonard

Try adding the following VB to a button on your master sheet

In Cell B1 in Sheet2 put a 1.

===========================
Set myRange = Range("A:A")
x = 3
y = Worksheets("Sheet2").Range("B1:B1").Value
Worksheets("Sheet2").Range("B1:B1").Value = y + 1

For Each c In myRange
If c.Value > 0 Then
Worksheets("Sheet2").Range("A1:A1").Offset(x, 2 + y).Value = c.Value
x = x + 1
Else
Exit For
End If
Next

myRange.Clear
=======================

You will see each time the button is pressed your range (sheet1 column A) is
cleared but not before the contents are copied to sheet2 column X starting
at row 4.

You can add worksheet functions like AVERAGE to Rows1,2,3 of sheet2 column X
as appropriate.

Hope this helps

Chris
 

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