Try to search your question here, if you can't find : Ask Any Question Now ?

VBA function does not returns a value

HomeCategory: stackoverflowVBA function does not returns a value
Avatarwillson asked 5 months ago

As a noob in vba I am writing a function in vba that returns income tax payable based on two supplied arguments

  1. first slab of income upto which no tax is payable
  2. total taxable income

I can not run the function due to error!

Public Function taxassess(fstslab As Double, incm As Double) As Variant
Dim j As Integer
Dim v As Variant
rates = Array(0, 10, 15, 20, 25, 30)
incmsslab = Array(fstslab, 650000, 1150000, 1750000, 4750000, 99999999999999#)
taxes = Array(0, 400000, 115000, 235000, 9850000)
For j = LBound(incmsslab) To UBound(incmsslab)
    If incmsslab(j) >= incm Then
        Exit For
    End If
Next j
Debug.Print j
parti = (incmsslab(j) - incm) * (rates(j) / 100)
tx = taxes(j - 1) + parti
Return tx

End Function

1 Answers
Best Answer
AvatarMikhail answered 5 months ago
Your Answer

6 + 19 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com