What's the cricket score?


Cricket is a popular sport in British Commonwealth countries, like Australia, and India. Each match has two sides. There are four components to a side's score:

  • Boundaries (sixes): 6 points each
  • Boundaries (fours): 4 points each
  • Singles: 1 point each
  • Sundries: 1 point each

You can read more about cricket scoring, if you want to know more.

Write a VBA program to compute a score given the information above. When the worksheet opens:


The user enters four values, clicks Run, and the program computes the score. For example:

Sample output

Here's some more sample output.

More sample output

All input values must be numeric and zero or more. If there are errors, show messages next to each erroneous cell, in red. Show all applicable error messages at once. For example:


Be sure to clear old error messages and output when the program runs.

Do not start from scratch. Download this worksheet, and add the code you need.

The usual coding standards apply.

Upload your solution.

Where referenced