Simple last 10 games VBA help

SPF

New Member
Joined
Jun 27, 2012
Messages
6
Players are listed down columns A1:A7 For example let's use the player in A1

Wins are listed in A2
Losses are listed in A3

Each player has a command button for when they beat another player.

I only want to display the most recent 10 games. So if player A has 6 in A2 and 4 in A3 and then wins another game, I need the code to add 1 to A2 and then subtract one from A3, thus keeping the record at last 10 by showing 7-3.

I'm sure this is very simple, but I can't figure it out. Any help would be greatly appreciated.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi and welcome to the forum.

Do you really need code? Consider this layout:

Sheet1

*ABC
1PlayerWinLose
2aaa19
3bbb55

<tbody>
</tbody>

Spreadsheet Formulas
CellFormula
C2=10-B2
C3=10-B3

<tbody>
</tbody>

<tbody>
</tbody>


Where B2 is a validation list, i.e.,

Select cell B2
Select Data => Data Validation
In the "Allow" box select List.
type in 1,2,3,4,5,6,7,8,9,10
And click OK.
You can then drag the validation list down the column just as you would a formula.

 
Upvote 0
You could use something like this. (

Code:
Range("B1").Value = 1 + Val(CStr(Range("B1").Value))
Range("C1").Value = Application.Min( 10 - Val(CStr(Range("B1").Value),  Val(CStr(Range("C1").Value) )
 
Upvote 0

Forum statistics

Threads
1,219,162
Messages
6,146,661
Members
450,706
Latest member
LGVBPP

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