Don't allow the user to enter negative numbers. Check the number before you calculate whether it is negative, if negative notify the user saying "Negative number is not allowed. Enter the positive number". Likevb Code:
Option Explicit Sub main() Dim I As Integer I = InputBox("Enter the number:") If I < 0 Then Call MsgBox("The number you entered is negative. Please enter the positive numbers.", vbExclamation, App.Title) Else '... Your Calculations End If End Sub




Reply With Quote