VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Calculates a percentage using the is over of = percent over 100 ratio. This code will either show

by Programming Innovations (7 Submissions)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 19th August 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Calculates a percentage using the "is over of = percent over 100" ratio. This code will either show a percentage (50% of 10 is 5, or 5 is 50%

Rate Calculates a percentage using the is over of = percent over 100 ratio. This code will either show



    Dim lTemp As Long
    On Error GoTo CheckForErrors
    
    If cPercent = 0 Then
        lTemp = cIs * 100
        CalcPercent = CLng(Int(lTemp / cOf))
    ElseIf cPercent <> 0 Then
        lTemp = cOf * cPercent
        CalcPercent = CLng(Int(lTemp / 100))
    End If
    Exit Function
    
'   Error Handler
CheckForErrors:
    If Err.Number = 6 Then
        CalcPercent = 0
        Resume Next
    ElseIf Err.Number = 11 Then
        CalcPercent = 0
        Resume Next
    ElseIf Err.Number = 3420 Then
        Resume Next
    ElseIf Err.Number <> 0 Then
        MsgBox err.number & ", " & err.description
        Resume Next
    End If
End Function

Download this snippet    Add to My Saved Code

Calculates a percentage using the is over of = percent over 100 ratio. This code will either show Comments

No comments have been posted about Calculates a percentage using the is over of = percent over 100 ratio. This code will either show. Why not be the first to post a comment about Calculates a percentage using the is over of = percent over 100 ratio. This code will either show.

Post your comment

Subject:
Message:
0/1000 characters