Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim payment As Double
  2. Dim deposit As Double
  3. Dim intPayment As Double
  4. Dim intDeposit As Double
  5. Dim endOfIntRegister As Integer
  6. Dim endOfProdRegister As Integer
  7. Dim endOfBankStatement As Integer
  8. Dim intRegisterStart As Integer
  9. Dim prodRegisterStart As Integer
  10. Dim bankStart As Integer
  11. Dim timesPaymentFound As Integer
  12. Dim timesDepositFound As Integer
  13.  
  14.  
  15. 'times found
  16. timesPaymentFound = 0
  17. timesDepositFound = 0
  18.  
  19. 'First rows
  20. intRegisterStart = 3
  21. prodRegisterStart = 3
  22. bankStart = 3
  23.  
  24. 'Last rows
  25. endOfIntRegister = 77
  26. endOfProdRegister = 18
  27. endOfBankStatement = 149
  28.  
  29.  
  30. 'Check payments of int register
  31. For i = bankStart To endOfBankStatement
  32.     payment = Cells(i, 27).Value
  33.     If payment > 0 Then
  34.     For j = intRegisterStart To endOfIntRegister
  35.         intPayment = Cells(j, 9).Value
  36.         If payment = intPayment And IsEmpty(Cells(j, 11)) Then
  37.             Cells(j, 11).Value = Cells(i, 25).Value
  38.             Cells(j, 12).Value = payment
  39.             timesPaymentFound = timesPaymentFound + 1
  40.             Exit For
  41.         End If
  42.     Next j
  43.     End If
  44.     'if not found in register highlight paymment
  45.    If payment > 0 And timesPaymentFound <= 0 Then
  46.         For k = 24 To 27
  47.             Cells(i, k).Interior.Color = RGB(255, 255, 153)
  48.             timesPaymentFound = 0
  49.         Next k
  50.     End If
  51.     'if found, grey it out
  52.    If payment > 0 And timesPaymentFound > 0 Then
  53.         For k = 24 To 27
  54.         Cells(i, k).Interior.Color = RGB(230, 230, 230)
  55.         Next k
  56.     End If
  57.     timesPaymentFound = 0
  58. Next i
  59.  
  60.  
  61. 'Check Deposits of int register
  62. For i = bankStart To endOfBankStatement
  63.     deposit = Cells(i, 26).Value
  64.     If deposit > 0 Then
  65.     For j = intRegisterStart To endOfIntRegister
  66.         intDeposit = Cells(j, 7).Value
  67.         If deposit = intDeposit And IsEmpty(Cells(j, 11)) Then
  68.             Cells(j, 11).Value = Cells(i, 25).Value
  69.             Cells(j, 10).Value = deposit
  70.             timesDepositFound = timesDepositFound + 1
  71.             Exit For
  72.         End If
  73.     Next j
  74.     'if not found in register, highlight bank statement line in yellow
  75.        If deposit > 0 And timesDepositFound <= 0 Then
  76.             For k = 24 To 27
  77.                 Cells(i, k).Interior.Color = RGB(181, 91, 31)
  78.             Next k
  79.         End If
  80.     'if found in register, grey out of bank statement
  81.        If deposit > 0 And timesDepositFound > 0 Then
  82.             For k = 24 To 27
  83.                 Cells(i, k).Interior.Color = RGB(230, 230, 230)
  84.             Next k
  85.         End If
  86.     End If
  87.     'reset times found
  88.    timesDepositFound = 0
  89. Next i
  90.  
  91. 'highlight unreconciled
  92. For i = 3 To 92
  93.     'if description is empty, bold and highlight that row
  94.   If IsEmpty(Cells(i, 11)) Then
  95.         For j = 1 To 9
  96.             Cells(i, j).Interior.Color = RGB(255, 255, 153)
  97.             Cells(i, j).Font.Bold = True
  98.         Next j
  99.     Else
  100.     'if description has something, fade that transaction out
  101.       For j = 1 To 9
  102.             Cells(i, j).Interior.Color = RGB(220, 220, 220)
  103.             Cells(i, j).Font.Color = RGB(100, 100, 100)
  104.         Next j
  105.     End If
  106. Next i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement