Dim intNumOfEmployees As Integer
Dim intAvg As Integer
Dim intTotalPay As Integer
Dim intNumOfPieces As Integer
Dim intTotalPieces As Integer
Private Sub mnuFileCalc_Click()
intNumOfPieces = Val(txtPieces)
lblPay = FormatCurrency(Pay(intNumOfPieces))
intNumOfEmployees = intNumOfEmployees + 1
intTotalPay = val(lblPay) + intTotalPay
intAvg = intNumOfEmployees / intTotalPay
intTotalPieces = intNumOfPieces + intTotalPieces
End Sub
Private Function Pay(intNumOfPiecesPASSED As Integer) As Currency
If intNumOfPiecesPASSED >= 1 And intNumOfPiecesPASSED <= 199 Then
Pay = intNumOfPiecesPASSED * 0.5
End If
If intNumOfPiecesPASSED >= 200 And intNumOfPiecesPASSED <= 399 Then
Pay = intNumOfPiecesPASSED * 0.55
End If
If intNumOfPiecesPASSED >= 400 And intNumOfPiecesPASSED <= 599 Then
Pay = intNumOfPiecesPASSED * 0.6
End If
If intNumOfPiecesPASSED >= 600 Then
Pay = intNumOfPiecesPASSED * 0.65
End If
End Function
intAvg = intNumOfEmployees / intTotalPay
is giving me division by zero error, what am I missing?
Dim intAvg As Integer
Dim intTotalPay As Integer
Dim intNumOfPieces As Integer
Dim intTotalPieces As Integer
Private Sub mnuFileCalc_Click()
intNumOfPieces = Val(txtPieces)
lblPay = FormatCurrency(Pay(intNumOfPieces))
intNumOfEmployees = intNumOfEmployees + 1
intTotalPay = val(lblPay) + intTotalPay
intAvg = intNumOfEmployees / intTotalPay
intTotalPieces = intNumOfPieces + intTotalPieces
End Sub
Private Function Pay(intNumOfPiecesPASSED As Integer) As Currency
If intNumOfPiecesPASSED >= 1 And intNumOfPiecesPASSED <= 199 Then
Pay = intNumOfPiecesPASSED * 0.5
End If
If intNumOfPiecesPASSED >= 200 And intNumOfPiecesPASSED <= 399 Then
Pay = intNumOfPiecesPASSED * 0.55
End If
If intNumOfPiecesPASSED >= 400 And intNumOfPiecesPASSED <= 599 Then
Pay = intNumOfPiecesPASSED * 0.6
End If
If intNumOfPiecesPASSED >= 600 Then
Pay = intNumOfPiecesPASSED * 0.65
End If
End Function
intAvg = intNumOfEmployees / intTotalPay
is giving me division by zero error, what am I missing?