Prevent your code from doing something crazy.
Your program could do something stupid, like try to divide by zero.
Some data to test.
Usually an error message.
If statement, like this:
- sApples = InputBox("How many apples?")
- sGoats = InputBox("How many goats?")
- ' Guard against goatlessness.
- If sGoats = 0 Then
- MsgBox "Goatlessness detected. Nobody gets apples."
- sApplesPerGoat = sApples / sGoats
- MsgBox sApplesPerGoat & " apples per goat"
- End If