You can use InputBoxes in the Code to get the information, but it is a clunky user interface.
You can use Cells on the Worksheet for user input and trigger the code when all input cells are not empty. See the Worksheet Change Event. or you can insert a CommandButton Control in the worksheet that the User can Click.
To get an A+, you can use a VBA UserForm with UserForm Controls to get the input, trigger the calculating code, and display the results. IMO, this is the most User Friendly and professional way.
If X = BonusHours
Then you could use a Select Case to select the Bonus Value and display it in a MsgBox.X = OTHours - 2 * AbsentHours / 3
Note that a Select Case is similar to an If... Then... IfElse... Statement in that when one condition is met, none of the others are checked, so
>40
>30
>0
Will only return one result
OR, you could use a User Defined Function to return the Bonus Value
Please note that while we do help students find a solution to their homework, we do not write any code for home work assignments. Yeah, I cheated with the formula for X, but that was a specific questionBonus = GetBonus(BonusHours)![]()




Reply With Quote