Hey guys. This is some VBA code I use in my Excel spreadsheet to keep track of my NW buxx withdraws. It is pretty quick and dirty, but it helps me. The rolling amounts for dep/WDs annoyed me so I made this. I treat deposits into Buxx as positive transactions and withdrawals as negative. I'm new here and wanted to give back. May or may not be of any use. You'll obviously have to modify it for your own spreadsheet.
PHP Code:
Sub Main()
Call find_avail_Deposit("A3:A100", "G2")
Call find_avail_Withdrawal("A3:A100", "H2")
Call find_avail_Deposit("C3:C100", "G3")
Call find_avail_Withdrawal("C3:C100", "H3")
End Sub
Sub find_avail_Deposit(amount_Range As String, total_Deposit_Cell As String)
Dim rCell As Range
Dim rRng As Range
Dim x As Integer
x = 0
Set rRng = Sheet4.Range(amount_Range)
For Each rCell In rRng.Cells
If rCell.Value > Date - 30 And rCell.Offset(0, 1).Value > 0 Then
x = rCell.Offset(0, 1).Value + x
End If
Next rCell
Range(total_Deposit_Cell).Value = 1000 - x
End Sub
Sub find_avail_Withdrawal(amount_Range As String, total_Withdraw_Cell As String)
Dim rCell As Range
Dim rRng As Range
Dim x As Integer
x = 0
Set rRng = Sheet4.Range(amount_Range)
For Each rCell In rRng.Cells
If rCell.Value > Date - 7 And rCell.Offset(0, 1).Value < 0 Then
x = rCell.Offset(0, 1).Value + x
End If
Next rCell
Range(total_Withdraw_Cell).Value = 800 + x
End Sub
Last edited by xjship; Oct 29, 2015 at 8:10 pm