Results 1 to 19 of 19

Thread: Dynamic tax calculator

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    VBAX Regular
    Joined
    Aug 2016
    Posts
    10
    Location
    ok, so I'm going to work through this step by step.

    1. It's a sub and a function - I have a sub that calls the tax function. Don't ask me why this is necessary, the book just wants it
    2. I have income as the input coming in from the sub - input box to request income
    3. added a message box at the end of the function to display the results - once I have a result :P
    4. Ok this is where it gets harder. Bear with me <3
    I tried to fill the arrays. I am on the right track or am I just leading myself down the garden path?
    Dim arrBreakPoint() As Integer
    Dim arrTaxPct() As Double
    Dim i As Integer
    Dim totalTax As Double
    Dim size As Long
    With Range("a3")        
        size = WorksheetFunction.CountA(Range(.Offset(1, 0)), Range(.Offset(.End(xlDown), 0)))
    End With
    ReDim arrBreakPoint(size)
    ReDim arrTaxPct(size)
    With Range("a3")
        For i = 1 To size
            arrBreakPoint(i) = Range(.Offset(i, 0)).Value
            arrTaxPct(i) = Range(.Offset(i, 1)).Value
        Next
    End With
    Oh, an HW: looked up integer and double - looks like the difference is precision and the decimal place. Integer being whole numbers. So I changed my totalTax to double and the taxPct to double?

    P.s I appreciate you basically teaching me arrays, I really do.
    Last edited by Aussiebear; 04-02-2025 at 05:04 AM. Reason: formatting

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •