Batting Average Problem

Input the number of at bats and hits for a batter, check to see number of at bats is not zero, if not create a function called BattingAverage  to calculate the players batting average by dividing the number of hits by the number of at bats. Use at bats and hits values as arguments for the function. Display “Batting Average” label and its numeric value as outputs.

 

Create a flowchart and VBA code to solve this problem. Create a command button on the spreadsheet named cmdAverage. Place the code under the Click event of a command button titled “Batting Ave”.

 

 

Flowchart Solution

Sample Screen Shots

VBA Solution Code