jnr_ironside
New Member
- Joined
- Apr 3, 2012
- Messages
- 5
I have a worksheet that is basically a score card for a cricket game.
I have the following code to input the score automatically:
Sub InsertScore1()
'InsertScore1 Macro
If Range("E2") = 0 Then
Else
Set c = Range("E9:AI18").Find(what:="", LookIn:=xlValues, SearchOrder:=xlByRows)
c.Value = Range("C2")
c.Activate
End If
End Sub
E2 is the Ball Counter, it goes from 0-6 so 0 = Start of new over
C2 is the score from the ball or the way Batsman is out (Bowled, Caught, LBW, or Stumped)
Both Change on a Button Click
E9:AI18 is my score card for 10 Batsman facing a maximum of 30 balls each (it is 31 Columns as the formula checks to see if the next cell in the range is blank so Coulumn E is empty to make sure the first value is entered in F9
I want the code to see if the active cell contains either Bowled, Caught, LBW or Stumped and if it does add the next score to the next batsman instead of just the next empty cell in the range.
So At the moment my code does this:
Batsman 1: 1 2 3 Caught 1 2 3
But I want it to do this:
Batsman 1: 1 2 3 Caught
Batman 2: 1 2 3
How could I achieve this please?
Ah... While writing this I' realised that if a Batsman faces all 30 balls then the first score for the next will go into E10 but I would need it to go in F10 and so on, how could I make sure this happens?
Thanks in advance.
I have the following code to input the score automatically:
Sub InsertScore1()
'InsertScore1 Macro
If Range("E2") = 0 Then
Else
Set c = Range("E9:AI18").Find(what:="", LookIn:=xlValues, SearchOrder:=xlByRows)
c.Value = Range("C2")
c.Activate
End If
End Sub
E2 is the Ball Counter, it goes from 0-6 so 0 = Start of new over
C2 is the score from the ball or the way Batsman is out (Bowled, Caught, LBW, or Stumped)
Both Change on a Button Click
E9:AI18 is my score card for 10 Batsman facing a maximum of 30 balls each (it is 31 Columns as the formula checks to see if the next cell in the range is blank so Coulumn E is empty to make sure the first value is entered in F9
I want the code to see if the active cell contains either Bowled, Caught, LBW or Stumped and if it does add the next score to the next batsman instead of just the next empty cell in the range.
So At the moment my code does this:
Batsman 1: 1 2 3 Caught 1 2 3
But I want it to do this:
Batsman 1: 1 2 3 Caught
Batman 2: 1 2 3
How could I achieve this please?
Ah... While writing this I' realised that if a Batsman faces all 30 balls then the first score for the next will go into E10 but I would need it to go in F10 and so on, how could I make sure this happens?
Thanks in advance.
Last edited: