Hello all, new to VBA/Marcos and need help with a function of a darts spreadsheet I'm developing. Did a google search and a few posts/threads from here came up so I figured I'd ask you guys for help.
I'm trying to create a sheet for a game of Cricket. For those of you that don't know how to play that game, you have to "close" the numbers 20 down to 15 as well as the bullseye by hitting each section three times. Throwing a dart into the Doubles area counts as 2 and the Triples area counts as 3, obviously. There is also a variation whereby if one player has closed a number and their opponent hasn't, then they can score points by hitting the closed number (I.E., if player one has closed the 20's and player 2 hasn't, each time player 1 throws a dart into the 20 area they get 20 added to their total score).
I downloaded a spreadsheet from another site that uses a dropdown list to select the number of hits and the score has to be entered manually, but I want to create a macro that does all this automatically. For example: I have six cells in one row like B4, B5, B6, B7, B8 and B9. B4/B7 have buttons in them, B5/B8 are blank, and B6/B9 have 0. I want to push the button in B4/B7 and have a 1 show in B5/B8. If the button is pressed again, a 2 shows in B5/B8 and if pressed a third time, a 3 shows. Then if pressed a fourth time, it stops the increment and checks the other cell to see if a 3 is there and if not then 20 is added to B6/B9 and if yes then nothing.
Now, I have adapted a code to do this but I don't know how to stop the increment nor to check the other cell. It is shown below. Any help someone here could provide would be greatly appreciated. I just hope what I'm asking isn't clear as mud.
I'm trying to create a sheet for a game of Cricket. For those of you that don't know how to play that game, you have to "close" the numbers 20 down to 15 as well as the bullseye by hitting each section three times. Throwing a dart into the Doubles area counts as 2 and the Triples area counts as 3, obviously. There is also a variation whereby if one player has closed a number and their opponent hasn't, then they can score points by hitting the closed number (I.E., if player one has closed the 20's and player 2 hasn't, each time player 1 throws a dart into the 20 area they get 20 added to their total score).
I downloaded a spreadsheet from another site that uses a dropdown list to select the number of hits and the score has to be entered manually, but I want to create a macro that does all this automatically. For example: I have six cells in one row like B4, B5, B6, B7, B8 and B9. B4/B7 have buttons in them, B5/B8 are blank, and B6/B9 have 0. I want to push the button in B4/B7 and have a 1 show in B5/B8. If the button is pressed again, a 2 shows in B5/B8 and if pressed a third time, a 3 shows. Then if pressed a fourth time, it stops the increment and checks the other cell to see if a 3 is there and if not then 20 is added to B6/B9 and if yes then nothing.
Now, I have adapted a code to do this but I don't know how to stop the increment nor to check the other cell. It is shown below. Any help someone here could provide would be greatly appreciated. I just hope what I'm asking isn't clear as mud.
Code:
Sub Button20_1()
Range("B5") = Range("B5") + 1
If Range("B5") = 4 = True Then
Range("B6") = Range("B6") + 20
End If
End Sub