S
Skinman
Hello all, I would like some assistance.
Using Excel 2007 on Vista
Confused with RoudUp and Round in procedure
Some thing to do with remainder didgets. How do I name them as long or
whatever
Public Sub CashFlow()
Const dCashCommission As Double = 0.05
Const dCashTake As Double = 0.2
Const dCashInvest As Double = 0.6
Dim dDistribute(1 To 4) As double
Dim i As Long
dAmount = ActiveCell.Value
'This next line in the macro I would like to change to:-
dDistribute(1) = RoundUp(dAmount * dCashCommission,2)
'change from Int to RoundUp? Works with Int, can't get it to work with
RoundUp
dDistribute(1) = Int(dAmount * dCashCommission)
dDistribute(2) = Int(dAmount * dCashTake)
dDistribute(3) = Int(dAmount * dCashInvest)
dDistribute(4) = dAmount - dDistribute(1) - dDistribute(2) -
dDistribute(3)
With Range("T1:T4")
For i = 1 To 4
.cells(i).Value = .cells(i).Value + dDistribute(i)
Next i
End With
ActiveCell.Offset(1, -14).Range("A1").Select
End Sub
Any help welcome and thanks.
Skinman
Using Excel 2007 on Vista
Confused with RoudUp and Round in procedure
Some thing to do with remainder didgets. How do I name them as long or
whatever
Public Sub CashFlow()
Const dCashCommission As Double = 0.05
Const dCashTake As Double = 0.2
Const dCashInvest As Double = 0.6
Dim dDistribute(1 To 4) As double
Dim i As Long
dAmount = ActiveCell.Value
'This next line in the macro I would like to change to:-
dDistribute(1) = RoundUp(dAmount * dCashCommission,2)
'change from Int to RoundUp? Works with Int, can't get it to work with
RoundUp
dDistribute(1) = Int(dAmount * dCashCommission)
dDistribute(2) = Int(dAmount * dCashTake)
dDistribute(3) = Int(dAmount * dCashInvest)
dDistribute(4) = dAmount - dDistribute(1) - dDistribute(2) -
dDistribute(3)
With Range("T1:T4")
For i = 1 To 4
.cells(i).Value = .cells(i).Value + dDistribute(i)
Next i
End With
ActiveCell.Offset(1, -14).Range("A1").Select
End Sub
Any help welcome and thanks.
Skinman