Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Function B15(bilkategori As String) As Long
- For i = 5 To 7
- If Cells(i, 4).Value = bilkategori Then
- Range("B15").Value = Cells(i, 5).Value 'når den finner bilkategori legger den tilsvarende døgnpris i B15
- End If
- Next i
- End Function
- Private Function B16(kmUt As Long, kmInn As Long)
- Range("B16").Value = kmInn - kmUt
- End Function
- Private Function B17()
- Dim antDager As Double
- antDager = Range("B10").Value - Range("B9").Value
- Range("B17").Value = Excel.WorksheetFunction.RoundUp(antDager, 0)
- End Function
- Private Function B18(bilkategori As String)
- Dim sum As Long
- For i = 5 To 7
- If Cells(i, 4).Value = bilkategori Then
- sum = Cells(i, 6).Value * Range("B17").Value
- sum = Range("B16").Value - sum
- If sum > 0 Then
- Range("B18").Value = sum
- Else
- Range("B18").Value = 0
- End If
- Exit For
- End If
- Next i
- End Function
- Private Function B19()
- Dim alder As Long
- alder = DateDiff("d", Range("b8").Value, Now)
- Range("B19").Value = alder / 365.25
- End Function
- Private Function B20()
- If Range("B7").Value = "Kvinne" Then
- Range("B20").Value = 1 - Range("E17").Value
- Else
- Range("B20").Value = 1
- End If
- End Function
- Private Function B21()
- If Range("B19").Value > Range("E16").Value Then
- Range("B21").Value = 1 - Range("E18").Value
- Else
- Range("B21").Value = 1
- End If
- End Function
- Private Function B24(bilkategori As String)
- For i = 5 To 7
- If Cells(i, 4).Value = bilkategori Then
- Range("B24").Value = Cells(i, 5).Value * Range("B17").Value
- End If
- Next i
- End Function
- Private Function B25(bilkategori As String)
- If Range("B18").Value > 0 Then
- For i = 5 To 7
- If Cells(i, 4).Value = bilkategori Then
- Range("B25").Value = Cells(i, 7).Value * Range("B18").Value
- End If
- Next i
- End If
- End Function
- Private Function B26()
- For i = 11 To 13
- If Cells(i, 4).Value = Range("B5").Value Then
- Exit For
- End If
- Next i
- For j = 5 To 7
- If Cells(10, j).Value = Range("B6").Value Then
- Exit For
- End If
- Next j
- Range("B26").Value = Cells(i, j).Value
- End Function
- Private Function B27()
- Range("B27").Value = Range("B20").Value * Range("B21").Value
- End Function
- Private Function B28()
- Range("B28").Value = (Range("B24").Value + Range("B25").Value + Range("B26").Value) * Range("B27").Value
- End Function
- Private Function B29()
- If Range("B28").Value > Range("E19").Value Then
- Range("B29").Value = -1 * ((Range("B28").Value - Range("E19").Value) * Range("E20").Value + Range("E19").Value * Range("E21").Value)
- Else
- Range("B29").Value = -1 * (Range("B28").Value * Range("B21").Value)
- End If
- End Function
- Private Function B30()
- Range("B30").Value = Range("B28").Value + Range("B29").Value
- End Function
- Private Sub btnCalculate_Click()
- Call B15(Cells(4, 2).Value) 'henter info fra B4
- Call B16(Range("B11").Value, Range("B12").Value) 'henter verdiene fra B11 og B12
- Call B17
- Call B18(Range("B4").Value)
- Call B19
- Call B20
- Call B21
- Call B24(Range("B4").Value)
- Call B25(Range("B4").Value)
- Call B26
- Call B27
- Call B28
- Call B29
- Call B30
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement