update,
This commit is contained in:
12
_del/task4.del/.editorconfig
Normal file
12
_del/task4.del/.editorconfig
Normal file
@@ -0,0 +1,12 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = latin1
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
BIN
_del/task4.del/dist/Expense_Report.xlsm
vendored
Normal file
BIN
_del/task4.del/dist/Expense_Report.xlsm
vendored
Normal file
Binary file not shown.
BIN
_del/task4.del/dist/step.png
(Stored with Git LFS)
vendored
Normal file
BIN
_del/task4.del/dist/step.png
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
_del/task4.del/from_client/Expense Report_original.xlsx
Normal file
BIN
_del/task4.del/from_client/Expense Report_original.xlsx
Normal file
Binary file not shown.
0
_del/task4.del/notes.md
Normal file
0
_del/task4.del/notes.md
Normal file
BIN
_del/task4.del/source/Expense_Report.xlsm
Normal file
BIN
_del/task4.del/source/Expense_Report.xlsm
Normal file
Binary file not shown.
1
_del/task4.del/source/dev.bat
Normal file
1
_del/task4.del/source/dev.bat
Normal file
@@ -0,0 +1 @@
|
||||
xlwings vba edit --file .\Expense_Report.xlsm
|
BIN
_del/task4_o/from_client/Expense Report.xlsx
Normal file
BIN
_del/task4_o/from_client/Expense Report.xlsx
Normal file
Binary file not shown.
0
_del/task4_o/notes.md
Normal file
0
_del/task4_o/notes.md
Normal file
BIN
_del/task4_o/source/Expense_Report.xlsx
Normal file
BIN
_del/task4_o/source/Expense_Report.xlsx
Normal file
Binary file not shown.
7
gitUpdate.bat
Normal file
7
gitUpdate.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
git status .
|
||||
|
||||
@pause
|
||||
|
||||
git add .
|
||||
git commit -m"update natalie0312,"
|
||||
start git push
|
15
meta.md
Normal file
15
meta.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
tags:
|
||||
- excel
|
||||
- vba
|
||||
- accounting
|
||||
---
|
||||
|
||||
# natalie0312, maxchan0823
|
||||
|
||||
## Things to note
|
||||
|
||||
個 user 識比 requirements,
|
||||
但係要問清楚佢有幾多條 record
|
||||
|
||||
e.g. 6000 row record ?
|
BIN
task1/Example_file.xlsx
Normal file
BIN
task1/Example_file.xlsx
Normal file
Binary file not shown.
BIN
task1/Q1.png
(Stored with Git LFS)
Normal file
BIN
task1/Q1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
task1/Q2.png
(Stored with Git LFS)
Normal file
BIN
task1/Q2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
task1/Q3.png
(Stored with Git LFS)
Normal file
BIN
task1/Q3.png
(Stored with Git LFS)
Normal file
Binary file not shown.
5
task1/QnA.md
Normal file
5
task1/QnA.md
Normal file
@@ -0,0 +1,5 @@
|
||||
你好,有小小野想問
|
||||
|
||||
Q1: "NA" 需要嗎?
|
||||
Q2: Debit / credit ?
|
||||
Q3: 8600 / 8700 ?
|
568
task1/ThisWorkbook.cls
Normal file
568
task1/ThisWorkbook.cls
Normal file
@@ -0,0 +1,568 @@
|
||||
Option Explicit
|
||||
Dim pres_right As Integer
|
||||
|
||||
Dim first_row As Integer
|
||||
Dim current_row As Integer
|
||||
Dim last_check_row As Integer
|
||||
|
||||
Dim amount_in_func As String
|
||||
Dim starting_cell As String
|
||||
|
||||
Dim grand_total_curr as currency
|
||||
Dim grand_total_str as string
|
||||
|
||||
Dim amount_in_func_curr as currency
|
||||
Dim amount_in_func_str as string
|
||||
|
||||
Dim pcco_str as string
|
||||
|
||||
Dim PCCO_COL as string
|
||||
Dim ACCOUNT_COL as string
|
||||
|
||||
Dim AMOUNT_IN_FUNC_COL as string
|
||||
Dim GRAND_TOTAL_COL As String
|
||||
Dim DEBIT_COL as string
|
||||
Dim CREDIT_COL as string
|
||||
Dim REMARKS_COL as string
|
||||
|
||||
Dim ADJUSTMENT_WORKSHEET as string
|
||||
Dim ADJUSTMENT_TEST_WORKSHEET as string
|
||||
|
||||
Dim AC_1020 as string
|
||||
Dim AC_8600 as string
|
||||
Dim AC_8601 as string
|
||||
Dim AC_8700 as string
|
||||
Dim AC_8701 as string
|
||||
Dim AC_1311 as string
|
||||
Dim AC_1375 as string
|
||||
Dim AC_2020 as string
|
||||
|
||||
Dim current_row_value_valid as boolean
|
||||
Dim check_next_row_ready as boolean
|
||||
|
||||
function writeRemarks(current_row as integer, remarks as string)
|
||||
Worksheets(ADJUSTMENT_WORKSHEET).Range(REMARKS_COL & CStr(current_row)).Value = remarks
|
||||
end function
|
||||
|
||||
function writeCredit(current_row as integer, credit as variant)
|
||||
Worksheets(ADJUSTMENT_WORKSHEET).Range(CREDIT_COL & CStr(current_row)).Value = abs(credit)
|
||||
Worksheets(ADJUSTMENT_WORKSHEET).Range(CREDIT_COL & CStr(current_row)).NumberFormat = "#,##0.00"
|
||||
|
||||
end function
|
||||
|
||||
function writeDebit(current_row as integer, debit as variant)
|
||||
Worksheets(ADJUSTMENT_WORKSHEET).Range(DEBIT_COL & CStr(current_row)).Value = abs(debit)
|
||||
Worksheets(ADJUSTMENT_WORKSHEET).Range(DEBIT_COL & CStr(current_row)).NumberFormat = "#,##0.00"
|
||||
end function
|
||||
|
||||
function writeAccount(current_row as integer, account as string)
|
||||
Worksheets(ADJUSTMENT_WORKSHEET).Range(ACCOUNT_COL & CStr(current_row)).Value = account
|
||||
end function
|
||||
|
||||
function getPCCO(current_row as integer)
|
||||
Dim output as string
|
||||
output = Worksheets(ADJUSTMENT_WORKSHEET).Range(PCCO_COL & CStr(current_row)).Value
|
||||
getPCCO = output
|
||||
end function
|
||||
|
||||
|
||||
function getGrandTotal(current_row as integer)
|
||||
Dim output as string
|
||||
output = Worksheets(ADJUSTMENT_WORKSHEET).Range(GRAND_TOTAL_COL & CStr(current_row)).text
|
||||
getGrandTotal = output
|
||||
end function
|
||||
|
||||
function getAmountInFunc(current_row as integer)
|
||||
Dim output as string
|
||||
output = Worksheets(ADJUSTMENT_WORKSHEET).Range(AMOUNT_IN_FUNC_COL & CStr(current_row)).Value
|
||||
debug.print output
|
||||
getAmountInFunc = output
|
||||
end function
|
||||
|
||||
function checkOutputCellReady(current_row as integer)
|
||||
Dim output as boolean
|
||||
output = True
|
||||
|
||||
Dim account_cell as variant
|
||||
account_cell = Worksheets(ADJUSTMENT_WORKSHEET).Range(ACCOUNT_COL & CStr(current_row))
|
||||
|
||||
if (IsEmpty(account_cell) = False) then
|
||||
output = False
|
||||
end if
|
||||
|
||||
checkOutputCellReady = output
|
||||
end function
|
||||
|
||||
|
||||
function checkCurrentRowValueValid(current_row as integer)
|
||||
Dim output as boolean
|
||||
output = True
|
||||
|
||||
if (checkIfGrandTotalRefNotFound(current_row) = True) then
|
||||
debug.print "grand total ref not found"
|
||||
|
||||
output = False
|
||||
end if
|
||||
|
||||
Dim grand_total_str as string
|
||||
dim amount_in_func_str as string
|
||||
dim pcco_str as string
|
||||
|
||||
grand_total_str = getGrandTotal(current_row)
|
||||
amount_in_func_str = getAmountInFunc(current_row)
|
||||
pcco_str = getPCCO(current_row)
|
||||
|
||||
' Debug.print InStr(pcco_str, "Error") >= 0
|
||||
' Debug.print InStr(amount_in_func_str, "N/A") >= 0
|
||||
' Debug.print InStr(grand_total_str, "N/A") >= 0
|
||||
|
||||
if (trim(pcco_str) = "" or InStr(pcco_str, "N/A") > 0 or InStr(pcco_str, "Error") > 0) then
|
||||
output = False
|
||||
end if
|
||||
|
||||
if (trim(amount_in_func_str) = "" or InStr(amount_in_func_str, "N/A") > 0 or InStr(amount_in_func_str, "Error") > 0) then
|
||||
output = False
|
||||
end if
|
||||
|
||||
if (trim(grand_total_str) = "" or InStr(grand_total_str, "N/A") > 0 or InStr(grand_total_str, "Error") > 0) then
|
||||
output = False
|
||||
end if
|
||||
|
||||
checkCurrentRowValueValid = output
|
||||
end function
|
||||
|
||||
function checkFullFillCasePCCOCode_P1375000Situation_1(grand_total as currency, amount_in_func as currency)
|
||||
' ### Special case (if PCCO Code = P1375000):
|
||||
' ### Situation 1:
|
||||
' if Grand total + amount in func > 0 (missing example)
|
||||
|
||||
checkFullFillCasePCCOCode_P1375000Situation_1 = (grand_total + amount_in_func > 0)
|
||||
end function
|
||||
|
||||
function checkFullFillCasePCCOCode_P1375000Situation_2(grand_total as currency, amount_in_func as currency)
|
||||
' ### Special case (if PCCO Code = P1375000):
|
||||
' ### Situation 2:
|
||||
' if Grand total + amount in func < 0 (row 21)
|
||||
|
||||
checkFullFillCasePCCOCode_P1375000Situation_2 = (grand_total + amount_in_func < 0)
|
||||
end function
|
||||
|
||||
function checkFullFillCasePCCOCode_P1375000Situation_3(grand_total as currency, amount_in_func as currency)
|
||||
' ### Special case (if PCCO Code = P1375000):
|
||||
' ### Situation 3:
|
||||
' if Grand total + amount in func = 0
|
||||
' - do nothing
|
||||
|
||||
checkFullFillCasePCCOCode_P1375000Situation_3 = (grand_total + amount_in_func = 0)
|
||||
end function
|
||||
|
||||
function checkFullFillCaseCommonSituation_1(grand_total as currency, amount_in_func as currency)
|
||||
' ### Situation 1:
|
||||
' if Grand total + amount in func > 0 (row 8 ?)
|
||||
checkFullFillCaseCommonSituation_1 = (grand_total + amount_in_func > 0)
|
||||
end function
|
||||
|
||||
function checkFullFillCaseCommonSituation_2(grand_total as currency, amount_in_func as currency)
|
||||
' ### Situation 2:
|
||||
' if Grand total + amount in func < 0 (row 8 ?)'
|
||||
checkFullFillCaseCommonSituation_2 = (grand_total + amount_in_func < 0)
|
||||
end function
|
||||
|
||||
function checkFullFillCaseCommonSituation_3(grand_total as currency, amount_in_func as currency)
|
||||
' ### Situation 3:
|
||||
' if Grand total + amount in func = 0
|
||||
checkFullFillCaseCommonSituation_3 = (grand_total + amount_in_func = 0)
|
||||
end function
|
||||
|
||||
function checkIfReferenceNotFound(cell as variant)
|
||||
Dim test_text as variant
|
||||
test_text = cell.text
|
||||
checkIfReferenceNotFound = (InStr(test_text, "#REF!") > 0)
|
||||
end function
|
||||
|
||||
function checkIfGrandTotalRefNotFound(current_row as integer)
|
||||
checkIfGrandTotalRefNotFound = checkIfReferenceNotFound (Worksheets(ADJUSTMENT_WORKSHEET).Range(GRAND_TOTAL_COL & CStr(current_row)))
|
||||
end function
|
||||
|
||||
function applyCommonSituation_1(current_row as integer)
|
||||
Dim net_var as variant
|
||||
Dim grand_total_var as variant
|
||||
Dim amount_in_func_var as variant
|
||||
|
||||
grand_total_var = CDec(getGrandTotal(current_row))
|
||||
amount_in_func_var = CDec(getAmountInFunc(current_row))
|
||||
net_var = grand_total_var + amount_in_func_var
|
||||
|
||||
' current row
|
||||
' - Account column: A1311, Debit column: Grand Total+amount in func
|
||||
writeAccount current_row, AC_1311
|
||||
writeDebit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account:1020,
|
||||
' - debit column: Grand Total+amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_1020
|
||||
writeDebit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account:NA8600,
|
||||
' - debit: grand total + amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_8600
|
||||
writeDebit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account NA8601,
|
||||
' - credit: grand total + amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_8601
|
||||
writeCredit current_row, net_var
|
||||
|
||||
applyCommonSituation_1 = True
|
||||
end function
|
||||
|
||||
function applyCommonSituation_2(current_row as integer)
|
||||
Dim net_var as variant
|
||||
Dim grand_total_var as variant
|
||||
Dim amount_in_func_var as variant
|
||||
|
||||
grand_total_var = CDec(getGrandTotal(current_row))
|
||||
amount_in_func_var = CDec(getAmountInFunc(current_row))
|
||||
net_var = grand_total_var + amount_in_func_var
|
||||
|
||||
' if Grand total + amount in func < 0 (row 8 ?)
|
||||
' - Account column: A1311,
|
||||
' - Credit column: Grand Total+amount in func
|
||||
writeAccount current_row, AC_1311
|
||||
writeCredit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account:1020,
|
||||
' - credit column: Grand Total+amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_1020
|
||||
writeCredit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account:NA8700,
|
||||
' - credit: grand total + amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_8700
|
||||
writeCredit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account NA8701,
|
||||
' - debit: grand total + amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_8701
|
||||
writeDebit current_row, net_var
|
||||
|
||||
applyCommonSituation_2 = True
|
||||
end function
|
||||
|
||||
function applyCommonSituation_3(current_row as integer)
|
||||
' if Grand total + amount in func = 0
|
||||
' - do nothing
|
||||
applyCommonSituation_3 = True
|
||||
end function
|
||||
|
||||
function applyPcco1375Situation_1(current_row as integer)
|
||||
Dim net_var as variant
|
||||
Dim grand_total_var as variant
|
||||
Dim amount_in_func_var as variant
|
||||
|
||||
grand_total_var = CDec(getGrandTotal(current_row))
|
||||
amount_in_func_var = CDec(getAmountInFunc(current_row))
|
||||
net_var = grand_total_var + amount_in_func_var
|
||||
|
||||
' - Account
|
||||
' - column: P1375,
|
||||
' - Debit column: Grand Total+amount in func
|
||||
writeAccount current_row, AC_1375
|
||||
writeDebit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account:2020,
|
||||
' - debit column: Grand Total+amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_2020
|
||||
writeDebit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account:NA8600,
|
||||
' - debit: grand total + amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_8600
|
||||
writeDebit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account NA8601,
|
||||
' - credit: grand total + amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_8601
|
||||
writeCredit current_row, net_var
|
||||
|
||||
applyPcco1375Situation_1 = True
|
||||
end function
|
||||
|
||||
function applyPcco1375Situation_2(current_row as integer)
|
||||
Dim net_var as variant
|
||||
Dim grand_total_var as variant
|
||||
Dim amount_in_func_var as variant
|
||||
|
||||
grand_total_var = CDec(getGrandTotal(current_row))
|
||||
amount_in_func_var = CDec(getAmountInFunc(current_row))
|
||||
net_var = grand_total_var + amount_in_func_var
|
||||
|
||||
' - Account
|
||||
' - column: P1375,
|
||||
' - Credit column: Grand Total+amount in func
|
||||
writeAccount current_row, AC_1375
|
||||
writeCredit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account:2020,
|
||||
' - credit column: Grand Total+amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_2020
|
||||
writeCredit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account:8700,
|
||||
' - credit: grand total + amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_8700
|
||||
writeCredit current_row, net_var
|
||||
|
||||
' - add row:
|
||||
' - account 8701,
|
||||
' - debit: grand total + amount in func
|
||||
insertNewRowBelow current_row
|
||||
current_row = current_row+ 1
|
||||
writeAccount current_row, AC_8701
|
||||
writeDebit current_row, net_var
|
||||
|
||||
applyPcco1375Situation_2= True
|
||||
end function
|
||||
|
||||
function applyPcco1375Situation_3(current_row as integer)
|
||||
' - do nothing
|
||||
applyPcco1375Situation_3 = True
|
||||
end function
|
||||
|
||||
|
||||
Sub test()
|
||||
' Debug.Assert True = isCurrentRowNeedToProcess("7")
|
||||
' Debug.Assert False = isCurrentRowNeedToProcess("180")
|
||||
' debug.assert False = isAllDone ("7")
|
||||
' debug.assert True = isAllDone ("180")
|
||||
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_1(-10,1)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_1(1,-10)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_1(-10,-10)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_1(0,0)
|
||||
' debug.assert True = checkFullFillCaseCommonSituation_1(0,1)
|
||||
' debug.assert True = checkFullFillCaseCommonSituation_1(1,0)
|
||||
' debug.assert True = checkFullFillCaseCommonSituation_1(1,1)
|
||||
|
||||
' debug.assert True = checkFullFillCaseCommonSituation_2(-10,1)
|
||||
' debug.assert True = checkFullFillCaseCommonSituation_2(1,-10)
|
||||
' debug.assert True = checkFullFillCaseCommonSituation_2(-10,-10)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_2(0,0)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_2(0,1)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_2(1,0)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_2(1,1)
|
||||
|
||||
' debug.assert True = checkFullFillCaseCommonSituation_3(0,0)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_3(1,1)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_3(-10,-10)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_3(1,0)
|
||||
' debug.assert False = checkFullFillCaseCommonSituation_3(0,1)
|
||||
|
||||
' debug.print Worksheets("Adjustment_TEST").Range("G86")
|
||||
|
||||
init
|
||||
|
||||
current_row = 29
|
||||
' amount_in_func_str = getAmountInFunc(current_row)
|
||||
' pcco_str = getPCCO(current_row)
|
||||
|
||||
' debug.print current_row
|
||||
' debug.print grand_total_str
|
||||
' debug.print checkIfGrandTotalRefNotFound(current_row)
|
||||
debug.print checkCurrentRowValueValid(current_row)
|
||||
|
||||
' current_row_value_valid = False
|
||||
' current_row_value_valid = checkCurrentRowValueValid(pcco_str, amount_in_func_str, grand_total_str)
|
||||
' check_next_row_ready = False
|
||||
' check_next_row_ready = checkOutputCellReady(current_row)
|
||||
|
||||
End Sub
|
||||
|
||||
Function getLastCheckRow(first_row As Integer)
|
||||
getLastCheckRow = first_row + 10
|
||||
End Function
|
||||
|
||||
function insertNewRowBelow(current_row as integer)
|
||||
Range("A"¤t_row+1).EntireRow.Insert
|
||||
end function
|
||||
|
||||
function isAllDone(input_row as integer)
|
||||
Dim cell_value As Currency
|
||||
Dim output as Boolean
|
||||
Dim i as integer
|
||||
output = true
|
||||
|
||||
last_check_row = getLastCheckRow(input_row)
|
||||
For i = input_row To last_check_row
|
||||
if (isCurrentRowNeedToProcess(i) = True) then
|
||||
output = false
|
||||
Exit For
|
||||
end if
|
||||
Next i
|
||||
|
||||
isAllDone = output
|
||||
end function
|
||||
|
||||
Function isCurrentRowNeedToProcess(input_row as integer)
|
||||
Dim output As Boolean
|
||||
Dim cell_value As Currency
|
||||
Dim input_cell as string
|
||||
input_cell = GRAND_TOTAL_COL & input_row
|
||||
|
||||
isCurrentRowNeedToProcess = not(IsEmpty(Worksheets(ADJUSTMENT_WORKSHEET).Range(input_cell).Value))
|
||||
End Function
|
||||
|
||||
Sub init()
|
||||
pres_right = 111
|
||||
first_row = 7
|
||||
current_row = first_row
|
||||
last_check_row = getLastCheckRow(first_row)
|
||||
|
||||
|
||||
GRAND_TOTAL_COL = "G"
|
||||
amount_in_func = "J"
|
||||
starting_cell = GRAND_TOTAL_COL & first_row
|
||||
PCCO_COL = "I"
|
||||
AMOUNT_IN_FUNC_COL = "J"
|
||||
DEBIT_COL = "N"
|
||||
CREDIT_COL= "O"
|
||||
ACCOUNT_COL = "M"
|
||||
REMARKS_COL = "Q"
|
||||
|
||||
AC_1020 = "AC_1020"
|
||||
AC_8600 = "AC_8600"
|
||||
AC_8601 = "AC_8601"
|
||||
AC_8700 = "AC_8700"
|
||||
AC_8701 = "AC_8701"
|
||||
AC_1311 = "AC_1311"
|
||||
AC_1375 = "AC_1375"
|
||||
AC_2020 = "AC_2020"
|
||||
|
||||
ADJUSTMENT_WORKSHEET = "Adjustment_TEST"
|
||||
' ADJUSTMENT_WORKSHEET = "Adjustment"
|
||||
|
||||
end sub
|
||||
|
||||
Sub Main()
|
||||
init
|
||||
|
||||
While isAllDone(current_row) = False
|
||||
debug.print "processing row: " & current_row
|
||||
debug.print checkCurrentRowValueValid(current_row)
|
||||
|
||||
|
||||
|
||||
current_row_value_valid = False
|
||||
current_row_value_valid = checkCurrentRowValueValid(current_row)
|
||||
check_next_row_ready = False
|
||||
check_next_row_ready = checkOutputCellReady(current_row)
|
||||
|
||||
|
||||
|
||||
if (current_row_value_valid and check_next_row_ready) then
|
||||
' input considered valid after this line
|
||||
|
||||
Dim grand_total_str as string
|
||||
dim amount_in_func_str as string
|
||||
dim pcco_str as string
|
||||
|
||||
grand_total_str = getGrandTotal(current_row)
|
||||
amount_in_func_str = getAmountInFunc(current_row)
|
||||
pcco_str = getPCCO(current_row)
|
||||
|
||||
debug.print "before"
|
||||
debug.print grand_total_str
|
||||
debug.print "pass"
|
||||
grand_total_curr = ccur(grand_total_str)
|
||||
|
||||
amount_in_func_curr = ccur(amount_in_func_str)
|
||||
|
||||
if (pcco_str = "P1375000") then
|
||||
if (checkFullFillCasePCCOCode_P1375000Situation_1(grand_total_curr, amount_in_func_curr) = True) then
|
||||
writeRemarks current_row, "P1375000 common sit 1"
|
||||
applyPcco1375Situation_1(current_row)
|
||||
Elseif (checkFullFillCasePCCOCode_P1375000Situation_2(grand_total_curr, amount_in_func_curr) = True) then
|
||||
writeRemarks current_row, "P1375000 common sit 2"
|
||||
applyPcco1375Situation_2(current_row)
|
||||
Elseif (checkFullFillCasePCCOCode_P1375000Situation_3(grand_total_curr, amount_in_func_curr) = True) then
|
||||
writeRemarks current_row, "P1375000 common sit 3"
|
||||
applyPcco1375Situation_3(current_row)
|
||||
Else
|
||||
msgbox "missing pcco 1375 situation"
|
||||
end if
|
||||
|
||||
Elseif (pcco_str = "N/A") then
|
||||
msgbox "pcco value is N/A"
|
||||
|
||||
Else
|
||||
if (checkFullFillCaseCommonSituation_1(grand_total_curr, amount_in_func_curr) = True) then
|
||||
writeRemarks current_row, "common sit 1"
|
||||
applyCommonSituation_1(current_row)
|
||||
Elseif (checkFullFillCaseCommonSituation_2(grand_total_curr, amount_in_func_curr) = True) then
|
||||
writeRemarks current_row, "common sit 2"
|
||||
applyCommonSituation_2(current_row)
|
||||
Elseif (checkFullFillCaseCommonSituation_3(grand_total_curr, amount_in_func_curr) = True) then
|
||||
writeRemarks current_row, "common sit 3"
|
||||
applyCommonSituation_3(current_row)
|
||||
Else
|
||||
msgbox "missing situation"
|
||||
end if
|
||||
end if
|
||||
|
||||
else
|
||||
debug.print "input is not valid, skipping row"
|
||||
|
||||
if (checkOutputCellReady(current_row)) then
|
||||
if (checkCurrentRowValueValid(current_row)) then
|
||||
else
|
||||
writeRemarks current_row, "input is not valid"
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
current_row = current_row + 1
|
||||
Wend
|
||||
|
||||
End Sub
|
||||
|
||||
Sub helloworld()
|
||||
' debug.print isCurrentRowNeedToProcess ("7")
|
||||
' debug.print isCurrentRowNeedToProcess ("180")
|
||||
|
||||
' debug.print isAllDone ("7")
|
||||
' debug.print isAllDone ("180")
|
||||
|
||||
End Sub
|
BIN
task1/_01_submit/Example_file.xlsm
Normal file
BIN
task1/_01_submit/Example_file.xlsm
Normal file
Binary file not shown.
75
task1/_01_submit/README.md
Normal file
75
task1/_01_submit/README.md
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
其實我做緊嘅係adjustment
|
||||
|
||||
係每個ISIN要有3樣野要做
|
||||
|
||||
### Situation 1:
|
||||
|
||||
如果 Grand total + amount in func > 0 (row 8 ?)
|
||||
|
||||
- Account column: A1311, Debit column: Grand Total+amount in func
|
||||
|
||||
- 加多行row:
|
||||
- account:1020,
|
||||
- debit column: Grand Total+amount in func
|
||||
|
||||
- 加多行row:
|
||||
- account:NA8600,
|
||||
- debit: grand total + amount in func
|
||||
|
||||
- 再加多行row:
|
||||
- account NA8601,
|
||||
- credit: grand total + amount in func
|
||||
|
||||
### Situation 2:
|
||||
|
||||
如果Grand total + amount in func < 0 (row 8 ?)
|
||||
|
||||
- Account column: A1311, Credit column: Grand Total+amount in func
|
||||
|
||||
- 加多行row: account:1020, credit column: Grand Total+amount in func
|
||||
|
||||
- 加多行row: account:NA8700, credit: grand total + amount in func
|
||||
|
||||
- 再加多行row: account NA8701, debit: grand total + amount in func
|
||||
|
||||
### Situation 3:
|
||||
|
||||
如果Grand total + amount in func = 0
|
||||
|
||||
- 咩都唔洗做
|
||||
|
||||
### Special case (如果PCCO Code係P1375000):
|
||||
|
||||
### Situation 1:
|
||||
|
||||
如果Grand total + amount in func > 0 (missing example)
|
||||
|
||||
- Account column: P1375, Debit column: Grand Total+amount in func
|
||||
|
||||
- 加多行row: account:2020, debit column: Grand Total+amount in func
|
||||
|
||||
- 加多行row: account:NA8600, debit: grand total + amount in func
|
||||
|
||||
- 再加多行row: account NA8601, credit: grand total + amount in func
|
||||
|
||||
|
||||
### Situation 2:
|
||||
|
||||
如果Grand total + amount in func < 0 (row 21)
|
||||
|
||||
- Account column: P1375, Credit column: Grand Total+amount in func
|
||||
|
||||
- 加多行row: account:2020, credit column: Grand Total+amount in func
|
||||
|
||||
- 加多行row: account:8700, credit: grand total + amount in func
|
||||
|
||||
- 再加多行row: account 8701, debit: grand total + amount in func
|
||||
|
||||
### Situation 3:
|
||||
|
||||
如果Grand total + amount in func = 0
|
||||
|
||||
- 咩都唔洗做
|
||||
|
||||
|
BIN
task1/_02_submit/Example_file_working_2016.xlsm
Normal file
BIN
task1/_02_submit/Example_file_working_2016.xlsm
Normal file
Binary file not shown.
BIN
task1/_02_submit/Example_file_working_2016_test1.xlsm
Normal file
BIN
task1/_02_submit/Example_file_working_2016_test1.xlsm
Normal file
Binary file not shown.
BIN
task1/_02_submit/Example_file_working_2016_test2.xlsm
Normal file
BIN
task1/_02_submit/Example_file_working_2016_test2.xlsm
Normal file
Binary file not shown.
BIN
task1/_02_submit/Example_file_working_2016_test2_deliver.xlsm
Normal file
BIN
task1/_02_submit/Example_file_working_2016_test2_deliver.xlsm
Normal file
Binary file not shown.
69
task1/_02_submit/README.md 2
Normal file
69
task1/_02_submit/README.md 2
Normal file
@@ -0,0 +1,69 @@
|
||||
|
||||
其實我做緊嘅係adjustment
|
||||
|
||||
係每個ISIN要有3樣野要做
|
||||
|
||||
### Situation 1:
|
||||
|
||||
如果 Grand total > 0 (row 8 ?)
|
||||
|
||||
- PCEC(Column I): 302210, PCCO: A1311000, Account column: 1020, debit column: Grand Total
|
||||
|
||||
|
||||
- 加多行row:
|
||||
- PCEC: 921810,
|
||||
- PCCO: 92100100
|
||||
- account:8600,
|
||||
- debit: grand total
|
||||
|
||||
- 再加多行row:
|
||||
- PCEC: 922910,
|
||||
- PCCO: 98900100
|
||||
- account:8601,
|
||||
- Credit: grand total
|
||||
### Situation 2:
|
||||
|
||||
如果Grand total < 0 (row 8 ?)
|
||||
|
||||
- PCEC(Column I): 302210, PCCO: A1311000, Account column: 1020, credit column: Grand Total
|
||||
|
||||
- 加多行row: PCEC: 922810, PCCO: 92200100, account:8700, credit: grand total
|
||||
|
||||
- 再加多行row: PCEC: 921910, PCCO: 98900200, account:8701, debit: grand total
|
||||
|
||||
### Situation 3:
|
||||
|
||||
如果Grand total = 0
|
||||
|
||||
- 咩都唔洗做
|
||||
|
||||
### Special case (如果PCCO Code係P1375000):
|
||||
|
||||
### Situation 1:
|
||||
|
||||
如果Grand total > 0 (missing example)
|
||||
|
||||
- PCEC(Column I): 302410, PCCO: P1375000, Account column: 2020, debit column: Grand Total
|
||||
|
||||
- 加多行row: PCEC: 921810, PCCO: 92100100, account:8600, debit: grand total
|
||||
|
||||
- 再加多行row: PCEC: 922910, PCCO: 98900100, account:8601, credit: grand total
|
||||
|
||||
|
||||
### Situation 2:
|
||||
|
||||
如果Grand total < 0 (row 21)
|
||||
|
||||
- PCEC(Column I): 302410, PCCO: P1375000, Account column: 2020, credit column: Grand Total
|
||||
|
||||
- 加多行row: PCEC: 922810, PCCO: 92200100, account:8700, credit: grand total
|
||||
|
||||
- 再加多行row: PCEC: 921910, PCCO: 98900200, account:8701, debit: grand total
|
||||
|
||||
### Situation 3:
|
||||
|
||||
如果Grand total = 0
|
||||
|
||||
- 咩都唔洗做
|
||||
|
||||
|
1032
task1/_02_submit/ThisWorkbook.cls
Normal file
1032
task1/_02_submit/ThisWorkbook.cls
Normal file
File diff suppressed because it is too large
Load Diff
1
task1/_02_submit/dev.bat
Normal file
1
task1/_02_submit/dev.bat
Normal file
@@ -0,0 +1 @@
|
||||
xlwings vba edit
|
13
task1/_02_submit/package.json
Normal file
13
task1/_02_submit/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "adjustment",
|
||||
"version": "1.0.0",
|
||||
"description": "adjustment",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"gitUpdate":"git add . && git commit -m \"update, \""
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
BIN
task1/_03_submit/Example_file_working_2016.xlsm
Normal file
BIN
task1/_03_submit/Example_file_working_2016.xlsm
Normal file
Binary file not shown.
BIN
task1/_03_submit/Example_file_working_2016_test1.xlsm
Normal file
BIN
task1/_03_submit/Example_file_working_2016_test1.xlsm
Normal file
Binary file not shown.
BIN
task1/_03_submit/Example_file_working_2016_test2.xlsm
Normal file
BIN
task1/_03_submit/Example_file_working_2016_test2.xlsm
Normal file
Binary file not shown.
BIN
task1/_03_submit/Example_file_working_2016_test2_deliver.xlsm
Normal file
BIN
task1/_03_submit/Example_file_working_2016_test2_deliver.xlsm
Normal file
Binary file not shown.
BIN
task1/_03_submit/Example_file_working_2016_test3.xlsm
Normal file
BIN
task1/_03_submit/Example_file_working_2016_test3.xlsm
Normal file
Binary file not shown.
BIN
task1/_03_submit/Example_file_working_2016_test3_deliver.xlsm
Normal file
BIN
task1/_03_submit/Example_file_working_2016_test3_deliver.xlsm
Normal file
Binary file not shown.
BIN
task1/_03_submit/Example_file_working_2016_test4.xlsm
Normal file
BIN
task1/_03_submit/Example_file_working_2016_test4.xlsm
Normal file
Binary file not shown.
BIN
task1/_03_submit/Example_file_working_2016_test4_deliver.xlsm
Normal file
BIN
task1/_03_submit/Example_file_working_2016_test4_deliver.xlsm
Normal file
Binary file not shown.
19
task1/_03_submit/Module1.bas
Normal file
19
task1/_03_submit/Module1.bas
Normal file
@@ -0,0 +1,19 @@
|
||||
Attribute VB_Name = "Module1"
|
||||
Sub Macro6()
|
||||
Attribute Macro6.VB_ProcData.VB_Invoke_Func = " \n14"
|
||||
'
|
||||
' Macro6 Macro
|
||||
'
|
||||
|
||||
'
|
||||
Sheets("Sheet1").Select
|
||||
Columns("B:P").Select
|
||||
Range("P1").Activate
|
||||
Selection.Copy
|
||||
Sheets("Adjustment").Select
|
||||
Columns("B:P").Select
|
||||
Range("P1").Activate
|
||||
Sheets("Adjustment").Paste
|
||||
|
||||
|
||||
End Sub
|
69
task1/_03_submit/README.md 2
Normal file
69
task1/_03_submit/README.md 2
Normal file
@@ -0,0 +1,69 @@
|
||||
|
||||
其實我做緊嘅係adjustment
|
||||
|
||||
係每個ISIN要有3樣野要做
|
||||
|
||||
### Situation 1:
|
||||
|
||||
如果 Grand total > 0 (row 8 ?)
|
||||
|
||||
- PCEC(Column I): 302210, PCCO: A1311000, Account column: 1020, debit column: Grand Total
|
||||
|
||||
|
||||
- 加多行row:
|
||||
- PCEC: 921810,
|
||||
- PCCO: 92100100
|
||||
- account:8600,
|
||||
- debit: grand total
|
||||
|
||||
- 再加多行row:
|
||||
- PCEC: 922910,
|
||||
- PCCO: 98900100
|
||||
- account:8601,
|
||||
- Credit: grand total
|
||||
### Situation 2:
|
||||
|
||||
如果Grand total < 0 (row 8 ?)
|
||||
|
||||
- PCEC(Column I): 302210, PCCO: A1311000, Account column: 1020, credit column: Grand Total
|
||||
|
||||
- 加多行row: PCEC: 922810, PCCO: 92200100, account:8700, credit: grand total
|
||||
|
||||
- 再加多行row: PCEC: 921910, PCCO: 98900200, account:8701, debit: grand total
|
||||
|
||||
### Situation 3:
|
||||
|
||||
如果Grand total = 0
|
||||
|
||||
- 咩都唔洗做
|
||||
|
||||
### Special case (如果PCCO Code係P1375000):
|
||||
|
||||
### Situation 1:
|
||||
|
||||
如果Grand total > 0 (missing example)
|
||||
|
||||
- PCEC(Column I): 302410, PCCO: P1375000, Account column: 2020, debit column: Grand Total
|
||||
|
||||
- 加多行row: PCEC: 921810, PCCO: 92100100, account:8600, debit: grand total
|
||||
|
||||
- 再加多行row: PCEC: 922910, PCCO: 98900100, account:8601, credit: grand total
|
||||
|
||||
|
||||
### Situation 2:
|
||||
|
||||
如果Grand total < 0 (row 21)
|
||||
|
||||
- PCEC(Column I): 302410, PCCO: P1375000, Account column: 2020, credit column: Grand Total
|
||||
|
||||
- 加多行row: PCEC: 922810, PCCO: 92200100, account:8700, credit: grand total
|
||||
|
||||
- 再加多行row: PCEC: 921910, PCCO: 98900200, account:8701, debit: grand total
|
||||
|
||||
### Situation 3:
|
||||
|
||||
如果Grand total = 0
|
||||
|
||||
- 咩都唔洗做
|
||||
|
||||
|
1150
task1/_03_submit/ThisWorkbook.cls
Normal file
1150
task1/_03_submit/ThisWorkbook.cls
Normal file
File diff suppressed because it is too large
Load Diff
1
task1/_03_submit/dev.bat
Normal file
1
task1/_03_submit/dev.bat
Normal file
@@ -0,0 +1 @@
|
||||
xlwings vba edit
|
13
task1/_03_submit/package.json
Normal file
13
task1/_03_submit/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "adjustment",
|
||||
"version": "1.0.0",
|
||||
"description": "adjustment",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"gitUpdate":"git add . && git commit -m \"update, \""
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
0
task1/_04_submit - Copy/.gitkeep
Normal file
0
task1/_04_submit - Copy/.gitkeep
Normal file
BIN
task1/_04_submit - Copy/5u2yvU318F.mp4
(Stored with Git LFS)
Normal file
BIN
task1/_04_submit - Copy/5u2yvU318F.mp4
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
task1/_04_submit - Copy/Example file updated.xlsx
Normal file
BIN
task1/_04_submit - Copy/Example file updated.xlsx
Normal file
Binary file not shown.
BIN
task1/_04_submit - Copy/Example_file_working_2016_test5.xlsm
Normal file
BIN
task1/_04_submit - Copy/Example_file_working_2016_test5.xlsm
Normal file
Binary file not shown.
Binary file not shown.
BIN
task1/_04_submit - Copy/Example_file_working_2016_test6.xlsm
Normal file
BIN
task1/_04_submit - Copy/Example_file_working_2016_test6.xlsm
Normal file
Binary file not shown.
Binary file not shown.
19
task1/_04_submit - Copy/Module1.bas
Normal file
19
task1/_04_submit - Copy/Module1.bas
Normal file
@@ -0,0 +1,19 @@
|
||||
Attribute VB_Name = "Module1"
|
||||
Sub Macro6()
|
||||
Attribute Macro6.VB_ProcData.VB_Invoke_Func = " \n14"
|
||||
'
|
||||
' Macro6 Macro
|
||||
'
|
||||
|
||||
'
|
||||
Sheets("Sheet1").Select
|
||||
Columns("B:P").Select
|
||||
Range("P1").Activate
|
||||
Selection.Copy
|
||||
Sheets("Adjustment").Select
|
||||
Columns("B:P").Select
|
||||
Range("P1").Activate
|
||||
Sheets("Adjustment").Paste
|
||||
|
||||
|
||||
End Sub
|
1421
task1/_04_submit - Copy/ThisWorkbook.cls
Normal file
1421
task1/_04_submit - Copy/ThisWorkbook.cls
Normal file
File diff suppressed because it is too large
Load Diff
0
task1/_04_submit/.gitkeep
Normal file
0
task1/_04_submit/.gitkeep
Normal file
BIN
task1/_04_submit/Example file updated.xlsx
Normal file
BIN
task1/_04_submit/Example file updated.xlsx
Normal file
Binary file not shown.
BIN
task1/_04_submit/Example_file_working_2016_test5.xlsm
Normal file
BIN
task1/_04_submit/Example_file_working_2016_test5.xlsm
Normal file
Binary file not shown.
BIN
task1/_04_submit/Example_file_working_2016_test5_deliver.xlsm
Normal file
BIN
task1/_04_submit/Example_file_working_2016_test5_deliver.xlsm
Normal file
Binary file not shown.
BIN
task1/_04_submit/Example_file_working_2016_test6.xlsm
Normal file
BIN
task1/_04_submit/Example_file_working_2016_test6.xlsm
Normal file
Binary file not shown.
BIN
task1/_04_submit/Example_file_working_2016_test6_deliver.xlsm
Normal file
BIN
task1/_04_submit/Example_file_working_2016_test6_deliver.xlsm
Normal file
Binary file not shown.
19
task1/_04_submit/Module1.bas
Normal file
19
task1/_04_submit/Module1.bas
Normal file
@@ -0,0 +1,19 @@
|
||||
Attribute VB_Name = "Module1"
|
||||
Sub Macro6()
|
||||
Attribute Macro6.VB_ProcData.VB_Invoke_Func = " \n14"
|
||||
'
|
||||
' Macro6 Macro
|
||||
'
|
||||
|
||||
'
|
||||
Sheets("Sheet1").Select
|
||||
Columns("B:P").Select
|
||||
Range("P1").Activate
|
||||
Selection.Copy
|
||||
Sheets("Adjustment").Select
|
||||
Columns("B:P").Select
|
||||
Range("P1").Activate
|
||||
Sheets("Adjustment").Paste
|
||||
|
||||
|
||||
End Sub
|
1421
task1/_04_submit/ThisWorkbook.cls
Normal file
1421
task1/_04_submit/ThisWorkbook.cls
Normal file
File diff suppressed because it is too large
Load Diff
BIN
task1/_incoming/Example_file.xlsx
Normal file
BIN
task1/_incoming/Example_file.xlsx
Normal file
Binary file not shown.
BIN
task1/_incoming/IMG_9450.jpeg
Normal file
BIN
task1/_incoming/IMG_9450.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 754 KiB |
BIN
task1/_incoming/IMG_9459.jpeg
Normal file
BIN
task1/_incoming/IMG_9459.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 474 KiB |
13
task1/package.json
Normal file
13
task1/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "natalie0312",
|
||||
"version": "1.0.0",
|
||||
"description": "excel adjustment",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"gitUpdate":"git add . && git commit -m\"update natalie0312,\""
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
BIN
task2/Copy and Paste.xlsm
Normal file
BIN
task2/Copy and Paste.xlsm
Normal file
Binary file not shown.
BIN
task2/d7a3b2ca-8184-4874-8f1b-21e77189936a_progressive.jpg
(Stored with Git LFS)
Normal file
BIN
task2/d7a3b2ca-8184-4874-8f1b-21e77189936a_progressive.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
task2/draft1/Copy and Paste_draft.xlsm
Normal file
BIN
task2/draft1/Copy and Paste_draft.xlsm
Normal file
Binary file not shown.
454
task2/draft1/ThisWorkbook.cls
Normal file
454
task2/draft1/ThisWorkbook.cls
Normal file
@@ -0,0 +1,454 @@
|
||||
' change log:
|
||||
|
||||
Option explicit
|
||||
|
||||
Dim first_row As Integer
|
||||
Dim current_row As Integer
|
||||
Dim last_check_row As Integer
|
||||
|
||||
Dim ADJUSTMENT_WORKSHEET as string
|
||||
Dim BMF_ADJUSTMENT_WORKSHEET as string
|
||||
|
||||
' BALANCE_SHEET
|
||||
Dim COL_BALANCE_SHEET_NA_1 as string
|
||||
Dim COL_BALANCE_SHEET_PCCO_1 as string
|
||||
Dim COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 as string
|
||||
|
||||
Dim COL_BALANCE_SHEET_NA_2 as string
|
||||
Dim COL_BALANCE_SHEET_PCCO_2 as string
|
||||
Dim COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 as string
|
||||
|
||||
' OFF_BALANCE_SHEET
|
||||
Dim COL_OFF_BALANCE_SHEET_NA_1 as string
|
||||
Dim COL_OFF_BALANCE_SHEET_PCCO_1 as string
|
||||
Dim COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 as string
|
||||
|
||||
Dim COL_OFF_BALANCE_SHEET_NA_2 as string
|
||||
Dim COL_OFF_BALANCE_SHEET_PCCO_2 as string
|
||||
Dim COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 as string
|
||||
|
||||
Dim COL_FINAL_BMF_ID as string
|
||||
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_LINE_TYPE as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_ID as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_COMMENT as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PCCO as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PCEC as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ACCOUNTING_BALANCE_CURRENCY as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_FAIR_VALUE as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ECONOMIC_AGENT as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_REMAINING_MATURITY as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_IFRS13 as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_COUNTRY as string
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT as string
|
||||
|
||||
|
||||
Sub init()
|
||||
On Error GoTo eh
|
||||
|
||||
' HEADER_ROW = 6
|
||||
first_row = 6
|
||||
current_row = first_row
|
||||
last_check_row = 9999
|
||||
|
||||
' ADJUSTMENT_SHEET
|
||||
ADJUSTMENT_WORKSHEET = "Adjustment"
|
||||
|
||||
' BALANCE_SHEET
|
||||
COL_BALANCE_SHEET_NA_1 = "Q"
|
||||
COL_BALANCE_SHEET_PCCO_1 = "R"
|
||||
COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 = "S"
|
||||
|
||||
COL_BALANCE_SHEET_NA_2 = "T"
|
||||
COL_BALANCE_SHEET_PCCO_2 = "U"
|
||||
COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 = "V"
|
||||
|
||||
' OFF_BALANCE_SHEET
|
||||
COL_OFF_BALANCE_SHEET_NA_1 = "X"
|
||||
COL_OFF_BALANCE_SHEET_PCCO_1 = "Y"
|
||||
COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 = "Z"
|
||||
|
||||
COL_OFF_BALANCE_SHEET_NA_2 = "AA"
|
||||
COL_OFF_BALANCE_SHEET_PCCO_2 = "AB"
|
||||
COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 = "AC"
|
||||
|
||||
COL_FINAL_BMF_ID = "AI"
|
||||
|
||||
' BMF_ADJUSTMENT_SHEET
|
||||
BMF_ADJUSTMENT_WORKSHEET = "BMF Adjustment result"
|
||||
COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID = "A"
|
||||
COL_BMF_ADJUSTMENT_SHEET_LINE_TYPE = "B"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_ID = "C"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE = "D"
|
||||
COL_BMF_ADJUSTMENT_SHEET_COMMENT = "E"
|
||||
COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY = "F"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PCCO = "G"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PCEC = "H"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ACCOUNTING_BALANCE_CURRENCY = "I"
|
||||
COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE = "J"
|
||||
COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT = "K"
|
||||
COL_BMF_ADJUSTMENT_SHEET_FAIR_VALUE = "BH"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ECONOMIC_AGENT = "BI"
|
||||
COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY = "BJ"
|
||||
COL_BMF_ADJUSTMENT_SHEET_REMAINING_MATURITY = "BK"
|
||||
COL_BMF_ADJUSTMENT_SHEET_IFRS13 = "BL"
|
||||
COL_BMF_ADJUSTMENT_SHEET_COUNTRY = "BM"
|
||||
COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT = "BN"
|
||||
|
||||
Done:
|
||||
Exit Sub
|
||||
|
||||
eh:
|
||||
Debug.Print "init:Error: " & Err.Description
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust2IsZero(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output as boolean
|
||||
output = false
|
||||
Dim temp as string
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
if (temp = "0") then
|
||||
output = true
|
||||
end if
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust2IsZero = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust2IsZero:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function CheckIfBalanceSheetNa2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output as boolean
|
||||
output = false
|
||||
Dim temp as string
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_2 & CStr(current_row)).Value
|
||||
|
||||
if (temp <> "") then
|
||||
output = true
|
||||
end if
|
||||
|
||||
CheckIfBalanceSheetNa2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetNa2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetPcco2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output as boolean
|
||||
output = false
|
||||
Dim temp as string
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(current_row)).Value
|
||||
|
||||
if (temp <> "") then
|
||||
output = true
|
||||
end if
|
||||
|
||||
CheckIfBalanceSheetPcco2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetPcco2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output as boolean
|
||||
output = false
|
||||
Dim temp as string
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
if (temp <> "") then
|
||||
output = true
|
||||
end if
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function isCurrentRowNeedToProcess(input_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
Dim cell_value As Currency
|
||||
Dim input_cell As String
|
||||
input_cell = GRANDTOTAL_COL & input_row
|
||||
|
||||
Done:
|
||||
isCurrentRowNeedToProcess = Not (IsEmpty(Worksheets(ADJUSTMENT_WORKSHEET).Range(input_cell).Value))
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "isCurrentRowNeedToProcess:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getLastCheckRow(first_row As Integer)
|
||||
On Error GoTo eh
|
||||
getLastCheckRow = first_row + 10
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getLastCheckRow:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
function checkAdjustmentSheetLastRow(current_row as integer)
|
||||
On Error GoTo eh
|
||||
Dim output as boolean
|
||||
output = True
|
||||
|
||||
dim j as integer
|
||||
Dim temp as string
|
||||
|
||||
For j = current_row to getLastCheckRow(current_row)
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(current_row)).Value
|
||||
if (temp <> "") then
|
||||
output = False
|
||||
end if
|
||||
next j
|
||||
|
||||
checkAdjustmentSheetLastRow = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "checkAdjustmentSheetLastRow:Error: " & Err.Description
|
||||
|
||||
end function
|
||||
|
||||
function checkBmfAdjustmentSheetLastRow(current_row as integer)
|
||||
On Error GoTo eh
|
||||
Dim output as boolean
|
||||
output = True
|
||||
|
||||
dim j as integer
|
||||
Dim temp as string
|
||||
|
||||
For j = current_row to getLastCheckRow(current_row)
|
||||
temp = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(current_row)).Value
|
||||
if (temp <> "") then
|
||||
output = False
|
||||
end if
|
||||
next j
|
||||
|
||||
checkBmfAdjustmentSheetLastRow = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "checkBmfAdjustmentSheetLastRow:Error: " & Err.Description
|
||||
|
||||
end function
|
||||
|
||||
Function checkIfAlreadyExistInBmfAdjustmentResult(adj_bmf_id as string, adj_pcco as string)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i as integer
|
||||
Dim bmf_adjustment_sheet_last_row as integer
|
||||
Dim found as boolean
|
||||
found = false
|
||||
Dim temp_value as string
|
||||
Dim bmf_adj_bmf_id as string
|
||||
Dim bmf_adj_pcco as string
|
||||
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
|
||||
For i = 1 to bmf_adjustment_sheet_last_row
|
||||
bmf_adj_bmf_id = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)).Value
|
||||
bmf_adj_pcco = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)).Value
|
||||
debug.print adj_bmf_id
|
||||
debug.print adj_pcco
|
||||
if (bmf_adj_bmf_id = adj_bmf_id and bmf_adj_pcco = adj_pcco ) then
|
||||
found = true
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)).Interior.Color = rgb(214, 48, 49)
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)).Interior.Color = rgb(214, 48, 49)
|
||||
exit for
|
||||
end if
|
||||
next i
|
||||
|
||||
checkIfAlreadyExistInBmfAdjustmentResult = found
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "checkIfAlreadyExistInBmfAdjustmentResult:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getBMFAdjustmentResultListEnd(start_row as integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i as integer
|
||||
|
||||
Dim last_row as boolean
|
||||
Dim last_row_found as boolean
|
||||
last_row_found = false
|
||||
last_row = True
|
||||
current_row = start_row
|
||||
|
||||
For i = start_row To 9999
|
||||
current_row = i
|
||||
last_row_found = checkBmfAdjustmentSheetLastRow(current_row)
|
||||
|
||||
if (last_row_found = true) then
|
||||
exit for
|
||||
end if
|
||||
Next i
|
||||
|
||||
getBMFAdjustmentResultListEnd = current_row -1
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getBMFAdjustmentResultListEnd:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getAdjustmentSheetListEnd(start_row as integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i as integer
|
||||
|
||||
Dim last_row as boolean
|
||||
Dim last_row_found as boolean
|
||||
last_row_found = false
|
||||
last_row = True
|
||||
current_row = start_row
|
||||
|
||||
For i = start_row To 9999
|
||||
current_row = i
|
||||
last_row_found = checkAdjustmentSheetLastRow(current_row)
|
||||
|
||||
if (last_row_found = true) then
|
||||
exit for
|
||||
end if
|
||||
Next i
|
||||
|
||||
getAdjustmentSheetListEnd = current_row -1
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getAdjustmentSheetListEnd:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Sub helloworld()
|
||||
On Error GoTo eh
|
||||
Dim need_to_copy as boolean
|
||||
|
||||
Dim adjustment_sheet_last_row as integer
|
||||
Dim adjustment_sheet_current_row as integer
|
||||
|
||||
Dim bmf_adjustment_sheet_last_row as integer
|
||||
Dim bmf_adjustment_sheet_current_row as integer
|
||||
|
||||
init
|
||||
'MsgBox "helloworld"
|
||||
adjustment_sheet_last_row= getAdjustmentSheetListEnd(first_row)
|
||||
|
||||
For adjustment_sheet_current_row = 6 To adjustment_sheet_last_row
|
||||
need_to_copy = false
|
||||
|
||||
Dim bmf_id as string
|
||||
Dim pcco as string
|
||||
bmf_id = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
pcco=Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
if (CheckIfBalanceSheetAmountToAdjust2Exist(adjustment_sheet_current_row) and CheckIfBalanceSheetNa2Exist(adjustment_sheet_current_row) and CheckIfBalanceSheetPcco2Exist(adjustment_sheet_current_row)) then
|
||||
if (CheckIfBalanceSheetAmountToAdjust2IsZero(adjustment_sheet_current_row)) then
|
||||
debug.print Cstr(adjustment_sheet_current_row) & " no need to copy as zero"
|
||||
|
||||
elseif (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco)) then
|
||||
debug.print "already exist in bmf table, skipping"
|
||||
else
|
||||
need_to_copy = True
|
||||
end if
|
||||
end if
|
||||
|
||||
' helloworld
|
||||
if (need_to_copy = true) then
|
||||
debug.print adjustment_sheet_current_row & " need to copy"
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
|
||||
Dim temp_value as string
|
||||
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " 15130"
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
' update formatting
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).NumberFormat = "#,##_);[Red](#,##)"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).NumberFormat = "#,##_);[Red](#,##)"
|
||||
|
||||
|
||||
else
|
||||
debug.print adjustment_sheet_current_row & " no need to copy"
|
||||
end if
|
||||
|
||||
|
||||
Next adjustment_sheet_current_row
|
||||
|
||||
Done:
|
||||
Exit Sub
|
||||
|
||||
eh:
|
||||
Debug.Print "helloworld:Error: " & Err.Description
|
||||
|
||||
End Sub
|
BIN
task2/draft2/Copy and Paste.xlsm
Normal file
BIN
task2/draft2/Copy and Paste.xlsm
Normal file
Binary file not shown.
BIN
task2/draft2/Copy and Paste.xlsx
Normal file
BIN
task2/draft2/Copy and Paste.xlsx
Normal file
Binary file not shown.
727
task2/draft2/ThisWorkbook.cls
Normal file
727
task2/draft2/ThisWorkbook.cls
Normal file
@@ -0,0 +1,727 @@
|
||||
' change log:
|
||||
|
||||
Option Explicit
|
||||
|
||||
Dim first_row As Integer
|
||||
Dim current_row As Integer
|
||||
Dim last_check_row As Integer
|
||||
|
||||
Dim ADJUSTMENT_WORKSHEET As String
|
||||
Dim BMF_ADJUSTMENT_WORKSHEET As String
|
||||
|
||||
' BALANCE_SHEET
|
||||
Dim COL_BALANCE_SHEET_NA_1 As String
|
||||
Dim COL_BALANCE_SHEET_PCCO_1 As String
|
||||
Dim COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 As String
|
||||
|
||||
Dim COL_BALANCE_SHEET_NA_2 As String
|
||||
Dim COL_BALANCE_SHEET_PCCO_2 As String
|
||||
Dim COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 As String
|
||||
|
||||
' OFF_BALANCE_SHEET
|
||||
Dim COL_OFF_BALANCE_SHEET_NA_1 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_PCCO_1 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 As String
|
||||
|
||||
Dim COL_OFF_BALANCE_SHEET_NA_2 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_PCCO_2 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 As String
|
||||
|
||||
Dim COL_FINAL_BMF_ID As String
|
||||
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_LINE_TYPE As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_ID As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_COMMENT As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PCCO As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PCEC As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ACCOUNTING_BALANCE_CURRENCY As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_FAIR_VALUE As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ECONOMIC_AGENT As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_REMAINING_MATURITY As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_IFRS13 As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_COUNTRY As String
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT As String
|
||||
|
||||
Dim RED_THOUSAND_SEP_NUMBER_FORMAT as string
|
||||
|
||||
Sub init()
|
||||
On Error GoTo eh
|
||||
|
||||
RED_THOUSAND_SEP_NUMBER_FORMAT = "#,##0_);[Red](#,##0)"
|
||||
|
||||
' HEADER_ROW = 6
|
||||
first_row = 6
|
||||
current_row = first_row
|
||||
last_check_row = 9999
|
||||
|
||||
' ADJUSTMENT_SHEET
|
||||
ADJUSTMENT_WORKSHEET = "Adjustment"
|
||||
|
||||
' BALANCE_SHEET
|
||||
COL_BALANCE_SHEET_NA_1 = "Q"
|
||||
COL_BALANCE_SHEET_PCCO_1 = "R"
|
||||
COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 = "S"
|
||||
|
||||
COL_BALANCE_SHEET_NA_2 = "T"
|
||||
COL_BALANCE_SHEET_PCCO_2 = "U"
|
||||
COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 = "V"
|
||||
|
||||
' OFF_BALANCE_SHEET
|
||||
COL_OFF_BALANCE_SHEET_NA_1 = "X"
|
||||
COL_OFF_BALANCE_SHEET_PCCO_1 = "Y"
|
||||
COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 = "Z"
|
||||
|
||||
COL_OFF_BALANCE_SHEET_NA_2 = "AA"
|
||||
COL_OFF_BALANCE_SHEET_PCCO_2 = "AB"
|
||||
COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 = "AC"
|
||||
|
||||
COL_FINAL_BMF_ID = "AI"
|
||||
|
||||
' BMF_ADJUSTMENT_SHEET
|
||||
BMF_ADJUSTMENT_WORKSHEET = "BMF Adjustment"
|
||||
COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID = "A"
|
||||
COL_BMF_ADJUSTMENT_SHEET_LINE_TYPE = "B"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_ID = "C"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE = "D"
|
||||
COL_BMF_ADJUSTMENT_SHEET_COMMENT = "E"
|
||||
COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY = "F"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PCCO = "G"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PCEC = "H"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ACCOUNTING_BALANCE_CURRENCY = "I"
|
||||
COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE = "J"
|
||||
COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT = "K"
|
||||
COL_BMF_ADJUSTMENT_SHEET_FAIR_VALUE = "BH"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ECONOMIC_AGENT = "BI"
|
||||
COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY = "BJ"
|
||||
COL_BMF_ADJUSTMENT_SHEET_REMAINING_MATURITY = "BK"
|
||||
COL_BMF_ADJUSTMENT_SHEET_IFRS13 = "BL"
|
||||
COL_BMF_ADJUSTMENT_SHEET_COUNTRY = "BM"
|
||||
COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT = "BN"
|
||||
|
||||
Done:
|
||||
Debug.Print "init done"
|
||||
Exit Sub
|
||||
|
||||
eh:
|
||||
Debug.Print "init:Error: " & Err.Description
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
function paintYellow(cell as variant)
|
||||
cell.Interior.Color = rgb(246, 229, 141)
|
||||
paintYellow = True
|
||||
end function
|
||||
|
||||
function paintRed(cell as variant)
|
||||
cell.Interior.Color = rgb(255, 121, 121)
|
||||
paintRed = True
|
||||
end function
|
||||
|
||||
Function CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)).Value
|
||||
|
||||
If ( temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow(Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed(Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed(Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_1 & CStr(current_row)))
|
||||
|
||||
output = True
|
||||
End If
|
||||
|
||||
|
||||
CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfAdjustmentSheetBmfIdValid(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfAdjustmentSheetBmfIdValid = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfAdjustmentSheetBmfIdValid:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
If ( temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow(Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed(Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed(Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_2 & CStr(current_row)))
|
||||
output = True
|
||||
End If
|
||||
|
||||
|
||||
CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust1NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
|
||||
Dim temp As String
|
||||
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)).Value
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust1NoNeedCopy:" & temp = "0"
|
||||
|
||||
If ( temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow(Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed(Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed(Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_1 & CStr(current_row)))
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust1NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust1NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust2NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
If ( temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow(Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed(Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed(Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(current_row)))
|
||||
output = True
|
||||
End If
|
||||
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust2NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust2NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function CheckIfBalanceSheetNa2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetNa2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetNa2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetPcco2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetPcco2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetPcco2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function isCurrentRowNeedToProcess(input_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
Dim cell_value As Currency
|
||||
Dim input_cell As String
|
||||
input_cell = GRANDTOTAL_COL & input_row
|
||||
|
||||
Done:
|
||||
isCurrentRowNeedToProcess = Not (IsEmpty(Worksheets(ADJUSTMENT_WORKSHEET).Range(input_cell).Value))
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "isCurrentRowNeedToProcess:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getLastCheckRow(first_row As Integer)
|
||||
On Error GoTo eh
|
||||
getLastCheckRow = first_row + 10
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getLastCheckRow:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function checkAdjustmentSheetLastRow(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = True
|
||||
|
||||
Dim j As Integer
|
||||
Dim temp As String
|
||||
|
||||
For j = current_row To getLastCheckRow(current_row)
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(current_row)).Value
|
||||
If (temp <> "") Then
|
||||
output = False
|
||||
End If
|
||||
Next j
|
||||
|
||||
checkAdjustmentSheetLastRow = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "checkAdjustmentSheetLastRow:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function checkBmfAdjustmentSheetLastRow(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = True
|
||||
|
||||
Dim j As Integer
|
||||
Dim temp As String
|
||||
|
||||
For j = current_row To getLastCheckRow(current_row)
|
||||
temp = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(current_row)).Value
|
||||
If (temp <> "") Then
|
||||
output = False
|
||||
End If
|
||||
Next j
|
||||
|
||||
checkBmfAdjustmentSheetLastRow = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "checkBmfAdjustmentSheetLastRow:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function checkIfAlreadyExistInBmfAdjustmentResult(adj_bmf_id As String, adj_pcco As String, adj_sheet_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i As Integer
|
||||
Dim bmf_adjustment_sheet_last_row As Integer
|
||||
Dim found As Boolean
|
||||
found = False
|
||||
Dim temp_value As String
|
||||
Dim bmf_adj_bmf_id As String
|
||||
Dim bmf_adj_pcco As String
|
||||
|
||||
Application.ScreenUpdating = False
|
||||
|
||||
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
|
||||
For i = 1 To bmf_adjustment_sheet_last_row
|
||||
bmf_adj_bmf_id = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)).Value
|
||||
bmf_adj_pcco = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)).Value
|
||||
|
||||
' debug.print bmf_adj_bmf_id
|
||||
' debug.print bmf_adj_pcco
|
||||
' debug.print adj_bmf_id
|
||||
' debug.print adj_pcco
|
||||
' debug.print bmf_adj_bmf_id = adj_bmf_id And bmf_adj_pcco = adj_pcco
|
||||
|
||||
|
||||
If (bmf_adj_bmf_id = adj_bmf_id And bmf_adj_pcco = adj_pcco) Then
|
||||
|
||||
' Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("B"&cstr(i)).value = Cstr(bmf_adj_bmf_id = adj_bmf_id)
|
||||
' Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("B"&cstr(i)).value = Cstr(bmf_adj_pcco = adj_pcco)
|
||||
|
||||
'Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)).Interior.Color = RGB(214, 48, 49)
|
||||
paintRed(Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)))
|
||||
' Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)).Interior.Color = RGB(214, 48, 49)
|
||||
paintred(Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)))
|
||||
|
||||
' adj_sheet_row
|
||||
|
||||
|
||||
found = True
|
||||
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
checkIfAlreadyExistInBmfAdjustmentResult = found
|
||||
|
||||
Application.ScreenUpdating = True
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Application.ScreenUpdating = True
|
||||
|
||||
Debug.Print "checkIfAlreadyExistInBmfAdjustmentResult:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getBMFAdjustmentResultListEnd(start_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
Dim last_row As Boolean
|
||||
Dim last_row_found As Boolean
|
||||
last_row_found = False
|
||||
last_row = True
|
||||
current_row = start_row
|
||||
|
||||
For i = start_row To 9999
|
||||
current_row = i
|
||||
last_row_found = checkBmfAdjustmentSheetLastRow(current_row)
|
||||
|
||||
If (last_row_found = True) Then
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
getBMFAdjustmentResultListEnd = current_row - 1
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getBMFAdjustmentResultListEnd:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getAdjustmentSheetListEnd(start_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
Dim last_row As Boolean
|
||||
Dim last_row_found As Boolean
|
||||
last_row_found = False
|
||||
last_row = True
|
||||
current_row = start_row
|
||||
|
||||
For i = start_row To 9999
|
||||
current_row = i
|
||||
last_row_found = checkAdjustmentSheetLastRow(current_row)
|
||||
|
||||
If (last_row_found = True) Then
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
getAdjustmentSheetListEnd = current_row - 1
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getAdjustmentSheetListEnd:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Sub resetBmfAdjustmentSheet()
|
||||
init
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A4:BN9999").Clear
|
||||
|
||||
end sub
|
||||
|
||||
Sub helloworld()
|
||||
On Error GoTo eh
|
||||
Dim need_to_copy As Boolean
|
||||
|
||||
Dim adjustment_sheet_first_row As Integer
|
||||
Dim adjustment_sheet_last_row As Integer
|
||||
Dim adjustment_sheet_current_row As Integer
|
||||
|
||||
Dim bmf_adjustment_sheet_last_row As Integer
|
||||
Dim bmf_adjustment_sheet_current_row As Integer
|
||||
|
||||
Dim temp_value As String
|
||||
|
||||
adjustment_sheet_first_row = 7
|
||||
|
||||
init
|
||||
' MsgBox "helloworld"
|
||||
adjustment_sheet_last_row = getAdjustmentSheetListEnd(adjustment_sheet_first_row)
|
||||
Debug.Print adjustment_sheet_last_row
|
||||
|
||||
For adjustment_sheet_current_row = adjustment_sheet_first_row To adjustment_sheet_last_row
|
||||
Debug.Print "processing adjustment_sheet_current_row: " & adjustment_sheet_current_row
|
||||
|
||||
' if (CheckIfBalanceSheetAmountToAdjust2Exist(adjustment_sheet_current_row) and CheckIfBalanceSheetNa2Exist(adjustment_sheet_current_row) and CheckIfBalanceSheetPcco2Exist(adjustment_sheet_current_row)) then
|
||||
If (CheckIfAdjustmentSheetBmfIdValid(adjustment_sheet_current_row)) Then
|
||||
Debug.Print "processing row: " & adjustment_sheet_current_row
|
||||
|
||||
Dim bmf_id As String
|
||||
bmf_id = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim bal_pcco_1 As String
|
||||
bal_pcco_1 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim bal_pcco_2 As String
|
||||
bal_pcco_2 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim off_bal_pcco_1 As String
|
||||
off_bal_pcco_1 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim off_bal_pcco_2 As String
|
||||
off_bal_pcco_2 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
' balance sheet 1
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
If (CheckIfBalanceSheetAmountToAdjust1NoNeedCopy(adjustment_sheet_current_row, bmf_id, bal_pcco_1) = True) Then
|
||||
' do skip
|
||||
Debug.Print "skip balance sheet 1"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
Debug.Print "bmf_adjustment_sheet_current_row:" & bmf_adjustment_sheet_current_row
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
' Selection.NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
' balance sheet 2
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
debug.print bal_pcco_2
|
||||
If (CheckIfBalanceSheetAmountToAdjust2NoNeedCopy(adjustment_sheet_current_row, bmf_id, bal_pcco_2)) Then
|
||||
' do skip
|
||||
Debug.Print "skip balance sheet 2"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
End If
|
||||
|
||||
' off-balance sheet 1
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
If (CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy(adjustment_sheet_current_row, bmf_id, off_bal_pcco_1)) Then
|
||||
' do skip
|
||||
Debug.Print "skip off-balance sheet 1"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_NA_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
End If
|
||||
|
||||
' off-balance sheet 2
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
If (CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy(adjustment_sheet_current_row, bmf_id, off_bal_pcco_2)) Then
|
||||
' do skip
|
||||
Debug.Print "skip off-balance sheet 2"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_NA_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
Debug.Print adjustment_sheet_current_row & " skipping copy as bmfid is empty"
|
||||
End If
|
||||
|
||||
|
||||
Next adjustment_sheet_current_row
|
||||
|
||||
Done:
|
||||
Exit Sub
|
||||
|
||||
eh:
|
||||
Debug.Print "helloworld:Error: " & Err.Description
|
||||
|
||||
End Sub
|
||||
|
24
task2/notes.md
Normal file
24
task2/notes.md
Normal file
@@ -0,0 +1,24 @@
|
||||
ttps://share-staging.louislabs.com/g/u-5_gKrQtGa
|
||||
|
||||
Q: 我見你個 screen capture 係 mac , 我想問下你會係 mac 定 window 度行?
|
||||
A: Window行的🙆🏻♀️🙆🏻♀️ 同上次一樣
|
||||
|
||||
# 我今次想做嘅野係將 adjustment 嘅資料 copy and paste 去到 BMF Adjustment 到
|
||||
|
||||

|
||||
|
||||
係 adjustment tab,你見到我圈咗4樣野分別寫咗1, 2, 3, 4
|
||||
|
||||
1. 每一行 copy 嘅 data 要連埋 AI column 嘅 BMF ID
|
||||
1. 第 2 個圈住嘅 data 唔係次次都會有,所以想有 value 先 copy and paste 上去
|
||||
- check if BalanceSheet_NA2 exist
|
||||
- check if BalanceSheet_PCCO2 exist
|
||||
- check if BalanceSheet_Amount_TO_ADJUST2 exist
|
||||
1. 如果 amount to adj 係 0, 就唔洗 copy and paste
|
||||
1. 係 BMF Adjustment tab 到,
|
||||
- 如果copy and paste咗過去,"reporting entity" columns 填 14004
|
||||
- 如果copy and paste咗過去,"Opaque reporting entity" columns 填 N
|
||||
1. 係BMF Adjustment tab到,
|
||||
- 個 "local operational Account" 就係 Adjustment tab 入面嘅 "NA" 加返 "15130"
|
||||
|
||||
我share 咗個sample file俾你 你幫我睇睇大概要幾錢🙇🏻♀️
|
13
task2/package.json
Normal file
13
task2/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "task2",
|
||||
"version": "1.0.0",
|
||||
"description": "excel adjustment",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"gitUpdate":"git add . && git commit -m\"update natalie0312,\""
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
BIN
task3/Copy and Paste 2.xlsm
Normal file
BIN
task3/Copy and Paste 2.xlsm
Normal file
Binary file not shown.
15
task3/Module1.bas
Normal file
15
task3/Module1.bas
Normal file
@@ -0,0 +1,15 @@
|
||||
Attribute VB_Name = "Module1"
|
||||
Sub Macro1()
|
||||
Attribute Macro1.VB_ProcData.VB_Invoke_Func = " \n14"
|
||||
'
|
||||
' Macro1 Macro
|
||||
'
|
||||
|
||||
'
|
||||
Sheets("BMF Adjustment").Select
|
||||
Rows("4:4").Select
|
||||
ActiveWindow.SmallScroll Down:=104
|
||||
Rows("4:124").Select
|
||||
Selection.Delete Shift:=xlUp
|
||||
Sheets("Raw Data").Select
|
||||
End Sub
|
1107
task3/ThisWorkbook.cls
Normal file
1107
task3/ThisWorkbook.cls
Normal file
File diff suppressed because it is too large
Load Diff
BIN
task3/_images/1.png
(Stored with Git LFS)
Normal file
BIN
task3/_images/1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
task3/_images/2.png
(Stored with Git LFS)
Normal file
BIN
task3/_images/2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
task3/_original/Copy and Paste 2.xlsm
Normal file
BIN
task3/_original/Copy and Paste 2.xlsm
Normal file
Binary file not shown.
828
task3/_original/Copy and Paste vba.txt
Normal file
828
task3/_original/Copy and Paste vba.txt
Normal file
@@ -0,0 +1,828 @@
|
||||
' change log:
|
||||
|
||||
Option Explicit
|
||||
|
||||
Dim first_row As Integer
|
||||
Dim current_row As Integer
|
||||
Dim last_check_row As Integer
|
||||
|
||||
Dim ADJUSTMENT_WORKSHEET As String
|
||||
Dim BMF_ADJUSTMENT_WORKSHEET As String
|
||||
|
||||
' Raw Data BALANCE_SHEET
|
||||
Dim COL_BALANCE_SHEET_NA_1 As String
|
||||
Dim COL_BALANCE_SHEET_PCCO_1 As String
|
||||
Dim COL_BALANCE_SHEET_PCEC_1 As String
|
||||
Dim COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 As String
|
||||
|
||||
Dim COL_BALANCE_SHEET_NA_2 As String
|
||||
Dim COL_BALANCE_SHEET_PCCO_2 As String
|
||||
Dim COL_BALANCE_SHEET_PCEC_2 As String
|
||||
Dim COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 As String
|
||||
|
||||
' Raw Data OFF_BALANCE_SHEET
|
||||
Dim COL_OFF_BALANCE_SHEET_NA_1 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_PCCO_1 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_PCEC_1 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 As String
|
||||
|
||||
Dim COL_OFF_BALANCE_SHEET_NA_2 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_PCCO_2 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_PCEC_2 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 As String
|
||||
|
||||
Dim COL_FINAL_BMF_ID As String
|
||||
|
||||
'BMF 1690 2690
|
||||
Dim COL_BMF16902690_SHEET_BMF_REFERENCE_ID As String 'Column C
|
||||
Dim COL_BMF16902690_SHEET_PCCO_CODE As String 'Column E
|
||||
Dim COL_BMF16902690_SHEET_PCEC_CODE As String 'Column F
|
||||
Dim COL_BMF16902690_SHEET_NA As String 'Column H
|
||||
Dim COL_BMF16902690_SHEET_AMOUNT_TO_ADJ As String 'Column M
|
||||
|
||||
'BMF Adjustment
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID As String 'Column A
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_LINE_TYPE As String 'Column B
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE As String 'Column D
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_COMMENT As String 'Column E
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY As String 'Column F
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PCCO As String 'Column G
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PCEC As String 'Column H
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ACCOUNTING_BALANCE_CURRENCY As String 'Column I
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE As String 'Column J
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT As String 'Column K
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE As String 'Column M
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG As String 'Column N
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG As String 'Column O
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ As String 'Column P
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT As String 'Column Q
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD As String 'Column R
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE As String 'Column S
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY As String 'Column BJ
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT As String 'Column BN
|
||||
|
||||
Dim RED_THOUSAND_SEP_NUMBER_FORMAT As String
|
||||
|
||||
Sub init()
|
||||
On Error GoTo eh
|
||||
|
||||
RED_THOUSAND_SEP_NUMBER_FORMAT = "#,##0_);[Red](#,##0)"
|
||||
|
||||
' HEADER_ROW = 6
|
||||
first_row = 6
|
||||
current_row = first_row
|
||||
last_check_row = 9999
|
||||
|
||||
' ADJUSTMENT_SHEET
|
||||
ADJUSTMENT_WORKSHEET = "Raw Data"
|
||||
|
||||
' BALANCE_SHEET
|
||||
COL_BALANCE_SHEET_NA_1 = "Q"
|
||||
COL_BALANCE_SHEET_PCCO_1 = "R"
|
||||
COL_BALANCE_SHEET_PCEC_1 = "S"
|
||||
COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 = "T"
|
||||
|
||||
COL_BALANCE_SHEET_NA_2 = "U"
|
||||
COL_BALANCE_SHEET_PCCO_2 = "V"
|
||||
COL_BALANCE_SHEET_PCEC_2 = "W"
|
||||
COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 = "X"
|
||||
|
||||
' OFF_BALANCE_SHEET
|
||||
COL_OFF_BALANCE_SHEET_NA_1 = "Z"
|
||||
COL_OFF_BALANCE_SHEET_PCCO_1 = "AA"
|
||||
COL_OFF_BALANCE_SHEET_PCEC_1 = "AB"
|
||||
COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 = "AC"
|
||||
|
||||
COL_OFF_BALANCE_SHEET_NA_2 = "AD"
|
||||
COL_OFF_BALANCE_SHEET_PCCO_2 = "AE"
|
||||
COL_OFF_BALANCE_SHEET_PCEC_2 = "AF"
|
||||
COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 = "AG"
|
||||
|
||||
COL_FINAL_BMF_ID = "AM"
|
||||
|
||||
' BMF_ADJUSTMENT_SHEET
|
||||
BMF_ADJUSTMENT_WORKSHEET = "BMF Adjustment"
|
||||
COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID = "A"
|
||||
COL_BMF_ADJUSTMENT_SHEET_LINE_TYPE = "B"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE = "D"
|
||||
COL_BMF_ADJUSTMENT_SHEET_COMMENT = "E"
|
||||
COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY = "F"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PCCO = "G"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PCEC = "H"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ACCOUNTING_BALANCE_CURRENCY = "I"
|
||||
COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE = "J"
|
||||
COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT = "K"
|
||||
COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE = "M"
|
||||
COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG = "N"
|
||||
COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG = "O"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ = "P"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT = "Q"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD = "R"
|
||||
COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE = "S"
|
||||
COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY = "BJ"
|
||||
COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT = "BN"
|
||||
|
||||
|
||||
Done:
|
||||
Debug.Print "init done"
|
||||
Exit Sub
|
||||
|
||||
eh:
|
||||
Debug.Print "init:Error: " & Err.Description
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Function paintYellow(cell As Variant)
|
||||
cell.Interior.Color = RGB(246, 229, 141)
|
||||
paintYellow = True
|
||||
End Function
|
||||
|
||||
Function paintRed(cell As Variant)
|
||||
cell.Interior.Color = RGB(255, 121, 121)
|
||||
paintRed = True
|
||||
End Function
|
||||
|
||||
Function CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)).Value
|
||||
|
||||
If (temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_1 & CStr(current_row)))
|
||||
|
||||
output = True
|
||||
End If
|
||||
|
||||
|
||||
CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfAdjustmentSheetBmfIdValid(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfAdjustmentSheetBmfIdValid = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfAdjustmentSheetBmfIdValid:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_2 & CStr(current_row)))
|
||||
output = True
|
||||
End If
|
||||
|
||||
|
||||
CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust1NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
|
||||
Dim temp As String
|
||||
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)).Value
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust1NoNeedCopy:" & temp = "0"
|
||||
|
||||
If (temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_1 & CStr(current_row)))
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust1NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust1NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust2NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(current_row)))
|
||||
output = True
|
||||
End If
|
||||
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust2NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust2NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetNa2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetNa2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetNa2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetPcco2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetPcco2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetPcco2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
Function CheckIfBalanceSheetPcec2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCEC_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetPcco2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetPcco2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function isCurrentRowNeedToProcess(input_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
Dim cell_value As Currency
|
||||
Dim input_cell As String
|
||||
input_cell = GRANDTOTAL_COL & input_row
|
||||
|
||||
Done:
|
||||
isCurrentRowNeedToProcess = Not (IsEmpty(Worksheets(ADJUSTMENT_WORKSHEET).Range(input_cell).Value))
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "isCurrentRowNeedToProcess:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getLastCheckRow(first_row As Integer)
|
||||
On Error GoTo eh
|
||||
getLastCheckRow = first_row + 10
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getLastCheckRow:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function checkAdjustmentSheetLastRow(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = True
|
||||
|
||||
Dim j As Integer
|
||||
Dim temp As String
|
||||
|
||||
For j = current_row To getLastCheckRow(current_row)
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(current_row)).Value
|
||||
If (temp <> "") Then
|
||||
output = False
|
||||
End If
|
||||
Next j
|
||||
|
||||
checkAdjustmentSheetLastRow = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "checkAdjustmentSheetLastRow:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function checkBmfAdjustmentSheetLastRow(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = True
|
||||
|
||||
Dim j As Integer
|
||||
Dim temp As String
|
||||
|
||||
For j = current_row To getLastCheckRow(current_row)
|
||||
temp = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(current_row)).Value
|
||||
If (temp <> "") Then
|
||||
output = False
|
||||
End If
|
||||
Next j
|
||||
|
||||
checkBmfAdjustmentSheetLastRow = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "checkBmfAdjustmentSheetLastRow:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function checkIfAlreadyExistInBmfAdjustmentResult(adj_bmf_id As String, adj_pcco As String, adj_sheet_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i As Integer
|
||||
Dim bmf_adjustment_sheet_last_row As Integer
|
||||
Dim found As Boolean
|
||||
found = False
|
||||
Dim temp_value As String
|
||||
Dim bmf_adj_bmf_id As String
|
||||
Dim bmf_adj_pcco As String
|
||||
Dim bmf_adj_pcec As String
|
||||
|
||||
Application.ScreenUpdating = False
|
||||
|
||||
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
|
||||
For i = 1 To bmf_adjustment_sheet_last_row
|
||||
bmf_adj_bmf_id = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)).Value
|
||||
bmf_adj_pcco = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)).Value
|
||||
bmf_adj_pcec = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(i)).Value
|
||||
|
||||
' debug.print bmf_adj_bmf_id
|
||||
' debug.print bmf_adj_pcco
|
||||
' debug.print adj_bmf_id
|
||||
' debug.print adj_pcco
|
||||
' debug.print bmf_adj_bmf_id = adj_bmf_id And bmf_adj_pcco = adj_pcco
|
||||
|
||||
|
||||
If (bmf_adj_bmf_id = adj_bmf_id And bmf_adj_pcco = adj_pcco) Then
|
||||
|
||||
' Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("B"&cstr(i)).value = Cstr(bmf_adj_bmf_id = adj_bmf_id)
|
||||
' Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("B"&cstr(i)).value = Cstr(bmf_adj_pcco = adj_pcco)
|
||||
|
||||
'Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)).Interior.Color = RGB(214, 48, 49)
|
||||
paintRed (Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)))
|
||||
' Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)).Interior.Color = RGB(214, 48, 49)
|
||||
paintRed (Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)))
|
||||
paintRed (Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(i)))
|
||||
|
||||
' adj_sheet_row
|
||||
|
||||
|
||||
found = True
|
||||
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
checkIfAlreadyExistInBmfAdjustmentResult = found
|
||||
|
||||
Application.ScreenUpdating = True
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Application.ScreenUpdating = True
|
||||
|
||||
Debug.Print "checkIfAlreadyExistInBmfAdjustmentResult:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getBMFAdjustmentResultListEnd(start_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
Dim last_row As Boolean
|
||||
Dim last_row_found As Boolean
|
||||
last_row_found = False
|
||||
last_row = True
|
||||
current_row = start_row
|
||||
|
||||
For i = start_row To 9999
|
||||
current_row = i
|
||||
last_row_found = checkBmfAdjustmentSheetLastRow(current_row)
|
||||
|
||||
If (last_row_found = True) Then
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
getBMFAdjustmentResultListEnd = current_row - 1
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getBMFAdjustmentResultListEnd:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getAdjustmentSheetListEnd(start_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
Dim last_row As Boolean
|
||||
Dim last_row_found As Boolean
|
||||
last_row_found = False
|
||||
last_row = True
|
||||
current_row = start_row
|
||||
|
||||
For i = start_row To 9999
|
||||
current_row = i
|
||||
last_row_found = checkAdjustmentSheetLastRow(current_row)
|
||||
|
||||
If (last_row_found = True) Then
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
getAdjustmentSheetListEnd = current_row - 1
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getAdjustmentSheetListEnd:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Sub resetBmfAdjustmentSheet()
|
||||
init
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A4:BN9999").Clear
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Main()
|
||||
On Error GoTo eh
|
||||
Dim need_to_copy As Boolean
|
||||
|
||||
Dim adjustment_sheet_first_row As Integer
|
||||
Dim adjustment_sheet_last_row As Integer
|
||||
Dim adjustment_sheet_current_row As Integer
|
||||
|
||||
Dim bmf_adjustment_sheet_last_row As Integer
|
||||
Dim bmf_adjustment_sheet_current_row As Integer
|
||||
|
||||
Dim temp_value As String
|
||||
|
||||
adjustment_sheet_first_row = 7
|
||||
|
||||
init
|
||||
' MsgBox "helloworld"
|
||||
adjustment_sheet_last_row = getAdjustmentSheetListEnd(adjustment_sheet_first_row)
|
||||
Debug.Print adjustment_sheet_last_row
|
||||
|
||||
For adjustment_sheet_current_row = adjustment_sheet_first_row To adjustment_sheet_last_row
|
||||
Debug.Print "processing adjustment_sheet_current_row: " & adjustment_sheet_current_row
|
||||
|
||||
' if (CheckIfBalanceSheetAmountToAdjust2Exist(adjustment_sheet_current_row) and CheckIfBalanceSheetNa2Exist(adjustment_sheet_current_row) and CheckIfBalanceSheetPcco2Exist(adjustment_sheet_current_row)) then
|
||||
If (CheckIfAdjustmentSheetBmfIdValid(adjustment_sheet_current_row)) Then
|
||||
Debug.Print "processing row: " & adjustment_sheet_current_row
|
||||
|
||||
Dim bmf_id As String
|
||||
bmf_id = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim bal_pcco_1 As String
|
||||
bal_pcco_1 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim bal_pcco_2 As String
|
||||
bal_pcco_2 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim off_bal_pcco_1 As String
|
||||
off_bal_pcco_1 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim off_bal_pcco_2 As String
|
||||
off_bal_pcco_2 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim bal_pcec_1 As String
|
||||
bal_pcec_1 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCEC_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim bal_pcec_2 As String
|
||||
bal_pcec_2 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCEC_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim off_bal_pcec_1 As String
|
||||
off_bal_pcec_1 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCEC_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim off_bal_pcec_2 As String
|
||||
off_bal_pcec_2 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCEC_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
' balance sheet 1
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
If (CheckIfBalanceSheetAmountToAdjust1NoNeedCopy(adjustment_sheet_current_row, bmf_id, bal_pcco_1) = True) Then
|
||||
' do skip
|
||||
Debug.Print "skip balance sheet 1"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
Debug.Print "bmf_adjustment_sheet_current_row:" & bmf_adjustment_sheet_current_row
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "E"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "01"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE & CStr(bmf_adjustment_sheet_current_row)).Value = "DQ"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_COMMENT & CStr(bmf_adjustment_sheet_current_row)).Value = "Unsettled bond adjustment for RWA purpose"
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCEC_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
' Selection.NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
' balance sheet 2
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
Debug.Print bal_pcco_2
|
||||
If (CheckIfBalanceSheetAmountToAdjust2NoNeedCopy(adjustment_sheet_current_row, bmf_id, bal_pcco_2)) Then
|
||||
' do skip
|
||||
Debug.Print "skip balance sheet 2"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "E"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "01"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE & CStr(bmf_adjustment_sheet_current_row)).Value = "DQ"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_COMMENT & CStr(bmf_adjustment_sheet_current_row)).Value = "Unsettled bond adjustment for RWA purpose"
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCEC_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
End If
|
||||
|
||||
' off-balance sheet 1
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
If (CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy(adjustment_sheet_current_row, bmf_id, off_bal_pcco_1)) Then
|
||||
' do skip
|
||||
Debug.Print "skip off-balance sheet 1"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "E"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "01"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE & CStr(bmf_adjustment_sheet_current_row)).Value = "DQ"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_COMMENT & CStr(bmf_adjustment_sheet_current_row)).Value = "Unsettled bond adjustment for RWA purpose"
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCEC_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_NA_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
End If
|
||||
|
||||
' off-balance sheet 2
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
If (CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy(adjustment_sheet_current_row, bmf_id, off_bal_pcco_2)) Then
|
||||
' do skip
|
||||
Debug.Print "skip off-balance sheet 2"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "E"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "01"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE & CStr(bmf_adjustment_sheet_current_row)).Value = "DQ"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_COMMENT & CStr(bmf_adjustment_sheet_current_row)).Value = "Unsettled bond adjustment for RWA purpose"
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCEC_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_NA_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
Debug.Print adjustment_sheet_current_row & " skipping copy as bmfid is empty"
|
||||
End If
|
||||
|
||||
|
||||
Next adjustment_sheet_current_row
|
||||
|
||||
Done:
|
||||
Exit Sub
|
||||
|
||||
eh:
|
||||
Debug.Print "helloworld:Error: " & Err.Description
|
||||
|
||||
End Sub
|
BIN
task3/_original/Copy and paste requirement.docx
Normal file
BIN
task3/_original/Copy and paste requirement.docx
Normal file
Binary file not shown.
BIN
task3/delivery1/Copy and Paste 2.xlsm
Normal file
BIN
task3/delivery1/Copy and Paste 2.xlsm
Normal file
Binary file not shown.
828
task3/delivery1/Copy and Paste vba.txt
Normal file
828
task3/delivery1/Copy and Paste vba.txt
Normal file
@@ -0,0 +1,828 @@
|
||||
' change log:
|
||||
|
||||
Option Explicit
|
||||
|
||||
Dim first_row As Integer
|
||||
Dim current_row As Integer
|
||||
Dim last_check_row As Integer
|
||||
|
||||
Dim ADJUSTMENT_WORKSHEET As String
|
||||
Dim BMF_ADJUSTMENT_WORKSHEET As String
|
||||
|
||||
' Raw Data BALANCE_SHEET
|
||||
Dim COL_BALANCE_SHEET_NA_1 As String
|
||||
Dim COL_BALANCE_SHEET_PCCO_1 As String
|
||||
Dim COL_BALANCE_SHEET_PCEC_1 As String
|
||||
Dim COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 As String
|
||||
|
||||
Dim COL_BALANCE_SHEET_NA_2 As String
|
||||
Dim COL_BALANCE_SHEET_PCCO_2 As String
|
||||
Dim COL_BALANCE_SHEET_PCEC_2 As String
|
||||
Dim COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 As String
|
||||
|
||||
' Raw Data OFF_BALANCE_SHEET
|
||||
Dim COL_OFF_BALANCE_SHEET_NA_1 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_PCCO_1 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_PCEC_1 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 As String
|
||||
|
||||
Dim COL_OFF_BALANCE_SHEET_NA_2 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_PCCO_2 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_PCEC_2 As String
|
||||
Dim COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 As String
|
||||
|
||||
Dim COL_FINAL_BMF_ID As String
|
||||
|
||||
'BMF 1690 2690
|
||||
Dim COL_BMF16902690_SHEET_BMF_REFERENCE_ID As String 'Column C
|
||||
Dim COL_BMF16902690_SHEET_PCCO_CODE As String 'Column E
|
||||
Dim COL_BMF16902690_SHEET_PCEC_CODE As String 'Column F
|
||||
Dim COL_BMF16902690_SHEET_NA As String 'Column H
|
||||
Dim COL_BMF16902690_SHEET_AMOUNT_TO_ADJ As String 'Column M
|
||||
|
||||
'BMF Adjustment
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID As String 'Column A
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_LINE_TYPE As String 'Column B
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE As String 'Column D
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_COMMENT As String 'Column E
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY As String 'Column F
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PCCO As String 'Column G
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PCEC As String 'Column H
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_ACCOUNTING_BALANCE_CURRENCY As String 'Column I
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE As String 'Column J
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT As String 'Column K
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE As String 'Column M
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG As String 'Column N
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG As String 'Column O
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ As String 'Column P
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT As String 'Column Q
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD As String 'Column R
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE As String 'Column S
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY As String 'Column BJ
|
||||
Dim COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT As String 'Column BN
|
||||
|
||||
Dim RED_THOUSAND_SEP_NUMBER_FORMAT As String
|
||||
|
||||
Sub init()
|
||||
On Error GoTo eh
|
||||
|
||||
RED_THOUSAND_SEP_NUMBER_FORMAT = "#,##0_);[Red](#,##0)"
|
||||
|
||||
' HEADER_ROW = 6
|
||||
first_row = 6
|
||||
current_row = first_row
|
||||
last_check_row = 9999
|
||||
|
||||
' ADJUSTMENT_SHEET
|
||||
ADJUSTMENT_WORKSHEET = "Raw Data"
|
||||
|
||||
' BALANCE_SHEET
|
||||
COL_BALANCE_SHEET_NA_1 = "Q"
|
||||
COL_BALANCE_SHEET_PCCO_1 = "R"
|
||||
COL_BALANCE_SHEET_PCEC_1 = "S"
|
||||
COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 = "T"
|
||||
|
||||
COL_BALANCE_SHEET_NA_2 = "U"
|
||||
COL_BALANCE_SHEET_PCCO_2 = "V"
|
||||
COL_BALANCE_SHEET_PCEC_2 = "W"
|
||||
COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 = "X"
|
||||
|
||||
' OFF_BALANCE_SHEET
|
||||
COL_OFF_BALANCE_SHEET_NA_1 = "Z"
|
||||
COL_OFF_BALANCE_SHEET_PCCO_1 = "AA"
|
||||
COL_OFF_BALANCE_SHEET_PCEC_1 = "AB"
|
||||
COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 = "AC"
|
||||
|
||||
COL_OFF_BALANCE_SHEET_NA_2 = "AD"
|
||||
COL_OFF_BALANCE_SHEET_PCCO_2 = "AE"
|
||||
COL_OFF_BALANCE_SHEET_PCEC_2 = "AF"
|
||||
COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 = "AG"
|
||||
|
||||
COL_FINAL_BMF_ID = "AM"
|
||||
|
||||
' BMF_ADJUSTMENT_SHEET
|
||||
BMF_ADJUSTMENT_WORKSHEET = "BMF Adjustment"
|
||||
COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID = "A"
|
||||
COL_BMF_ADJUSTMENT_SHEET_LINE_TYPE = "B"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE = "D"
|
||||
COL_BMF_ADJUSTMENT_SHEET_COMMENT = "E"
|
||||
COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY = "F"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PCCO = "G"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PCEC = "H"
|
||||
COL_BMF_ADJUSTMENT_SHEET_ACCOUNTING_BALANCE_CURRENCY = "I"
|
||||
COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE = "J"
|
||||
COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT = "K"
|
||||
COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE = "M"
|
||||
COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG = "N"
|
||||
COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG = "O"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ = "P"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT = "Q"
|
||||
COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD = "R"
|
||||
COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE = "S"
|
||||
COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY = "BJ"
|
||||
COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT = "BN"
|
||||
|
||||
|
||||
Done:
|
||||
Debug.Print "init done"
|
||||
Exit Sub
|
||||
|
||||
eh:
|
||||
Debug.Print "init:Error: " & Err.Description
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Function paintYellow(cell As Variant)
|
||||
cell.Interior.Color = RGB(246, 229, 141)
|
||||
paintYellow = True
|
||||
End Function
|
||||
|
||||
Function paintRed(cell As Variant)
|
||||
cell.Interior.Color = RGB(255, 121, 121)
|
||||
paintRed = True
|
||||
End Function
|
||||
|
||||
Function CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)).Value
|
||||
|
||||
If (temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_1 & CStr(current_row)))
|
||||
|
||||
output = True
|
||||
End If
|
||||
|
||||
|
||||
CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfAdjustmentSheetBmfIdValid(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfAdjustmentSheetBmfIdValid = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfAdjustmentSheetBmfIdValid:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_2 & CStr(current_row)))
|
||||
output = True
|
||||
End If
|
||||
|
||||
|
||||
CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust1NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
|
||||
Dim temp As String
|
||||
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)).Value
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust1NoNeedCopy:" & temp = "0"
|
||||
|
||||
If (temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_1 & CStr(current_row)))
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust1NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust1NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust2NoNeedCopy(current_row As Integer, bmf_id As String, pcco As String)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp = "") Then
|
||||
output = True
|
||||
ElseIf (temp = "0") Then
|
||||
paintYellow (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)))
|
||||
output = True
|
||||
ElseIf (checkIfAlreadyExistInBmfAdjustmentResult(bmf_id, pcco, current_row)) Then
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range("AI" & CStr(current_row)))
|
||||
paintRed (Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(current_row)))
|
||||
output = True
|
||||
End If
|
||||
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust2NoNeedCopy = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust2NoNeedCopy:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetNa2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetNa2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetNa2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckIfBalanceSheetPcco2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetPcco2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetPcco2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
Function CheckIfBalanceSheetPcec2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCEC_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetPcco2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetPcco2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Function CheckIfBalanceSheetAmountToAdjust2Exist(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
output = False
|
||||
Dim temp As String
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(current_row)).Value
|
||||
|
||||
If (temp <> "") Then
|
||||
output = True
|
||||
End If
|
||||
|
||||
CheckIfBalanceSheetAmountToAdjust2Exist = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "CheckIfBalanceSheetAmountToAdjust2Exist:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function isCurrentRowNeedToProcess(input_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim output As Boolean
|
||||
Dim cell_value As Currency
|
||||
Dim input_cell As String
|
||||
input_cell = GRANDTOTAL_COL & input_row
|
||||
|
||||
Done:
|
||||
isCurrentRowNeedToProcess = Not (IsEmpty(Worksheets(ADJUSTMENT_WORKSHEET).Range(input_cell).Value))
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "isCurrentRowNeedToProcess:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getLastCheckRow(first_row As Integer)
|
||||
On Error GoTo eh
|
||||
getLastCheckRow = first_row + 10
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getLastCheckRow:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function checkAdjustmentSheetLastRow(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = True
|
||||
|
||||
Dim j As Integer
|
||||
Dim temp As String
|
||||
|
||||
For j = current_row To getLastCheckRow(current_row)
|
||||
temp = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(current_row)).Value
|
||||
If (temp <> "") Then
|
||||
output = False
|
||||
End If
|
||||
Next j
|
||||
|
||||
checkAdjustmentSheetLastRow = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "checkAdjustmentSheetLastRow:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function checkBmfAdjustmentSheetLastRow(current_row As Integer)
|
||||
On Error GoTo eh
|
||||
Dim output As Boolean
|
||||
output = True
|
||||
|
||||
Dim j As Integer
|
||||
Dim temp As String
|
||||
|
||||
For j = current_row To getLastCheckRow(current_row)
|
||||
temp = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(current_row)).Value
|
||||
If (temp <> "") Then
|
||||
output = False
|
||||
End If
|
||||
Next j
|
||||
|
||||
checkBmfAdjustmentSheetLastRow = output
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "checkBmfAdjustmentSheetLastRow:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function checkIfAlreadyExistInBmfAdjustmentResult(adj_bmf_id As String, adj_pcco As String, adj_sheet_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i As Integer
|
||||
Dim bmf_adjustment_sheet_last_row As Integer
|
||||
Dim found As Boolean
|
||||
found = False
|
||||
Dim temp_value As String
|
||||
Dim bmf_adj_bmf_id As String
|
||||
Dim bmf_adj_pcco As String
|
||||
Dim bmf_adj_pcec As String
|
||||
|
||||
Application.ScreenUpdating = False
|
||||
|
||||
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
|
||||
For i = 1 To bmf_adjustment_sheet_last_row
|
||||
bmf_adj_bmf_id = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)).Value
|
||||
bmf_adj_pcco = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)).Value
|
||||
bmf_adj_pcec = Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(i)).Value
|
||||
|
||||
' debug.print bmf_adj_bmf_id
|
||||
' debug.print bmf_adj_pcco
|
||||
' debug.print adj_bmf_id
|
||||
' debug.print adj_pcco
|
||||
' debug.print bmf_adj_bmf_id = adj_bmf_id And bmf_adj_pcco = adj_pcco
|
||||
|
||||
|
||||
If (bmf_adj_bmf_id = adj_bmf_id And bmf_adj_pcco = adj_pcco) Then
|
||||
|
||||
' Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("B"&cstr(i)).value = Cstr(bmf_adj_bmf_id = adj_bmf_id)
|
||||
' Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("B"&cstr(i)).value = Cstr(bmf_adj_pcco = adj_pcco)
|
||||
|
||||
'Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)).Interior.Color = RGB(214, 48, 49)
|
||||
paintRed (Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(i)))
|
||||
' Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)).Interior.Color = RGB(214, 48, 49)
|
||||
paintRed (Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(i)))
|
||||
paintRed (Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(i)))
|
||||
|
||||
' adj_sheet_row
|
||||
|
||||
|
||||
found = True
|
||||
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
checkIfAlreadyExistInBmfAdjustmentResult = found
|
||||
|
||||
Application.ScreenUpdating = True
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Application.ScreenUpdating = True
|
||||
|
||||
Debug.Print "checkIfAlreadyExistInBmfAdjustmentResult:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getBMFAdjustmentResultListEnd(start_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
Dim last_row As Boolean
|
||||
Dim last_row_found As Boolean
|
||||
last_row_found = False
|
||||
last_row = True
|
||||
current_row = start_row
|
||||
|
||||
For i = start_row To 9999
|
||||
current_row = i
|
||||
last_row_found = checkBmfAdjustmentSheetLastRow(current_row)
|
||||
|
||||
If (last_row_found = True) Then
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
getBMFAdjustmentResultListEnd = current_row - 1
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getBMFAdjustmentResultListEnd:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
Function getAdjustmentSheetListEnd(start_row As Integer)
|
||||
On Error GoTo eh
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
Dim last_row As Boolean
|
||||
Dim last_row_found As Boolean
|
||||
last_row_found = False
|
||||
last_row = True
|
||||
current_row = start_row
|
||||
|
||||
For i = start_row To 9999
|
||||
current_row = i
|
||||
last_row_found = checkAdjustmentSheetLastRow(current_row)
|
||||
|
||||
If (last_row_found = True) Then
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
getAdjustmentSheetListEnd = current_row - 1
|
||||
|
||||
Done:
|
||||
Exit Function
|
||||
|
||||
eh:
|
||||
Debug.Print "getAdjustmentSheetListEnd:Error: " & Err.Description
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Sub resetBmfAdjustmentSheet()
|
||||
init
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A4:BN9999").Clear
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Main()
|
||||
On Error GoTo eh
|
||||
Dim need_to_copy As Boolean
|
||||
|
||||
Dim adjustment_sheet_first_row As Integer
|
||||
Dim adjustment_sheet_last_row As Integer
|
||||
Dim adjustment_sheet_current_row As Integer
|
||||
|
||||
Dim bmf_adjustment_sheet_last_row As Integer
|
||||
Dim bmf_adjustment_sheet_current_row As Integer
|
||||
|
||||
Dim temp_value As String
|
||||
|
||||
adjustment_sheet_first_row = 7
|
||||
|
||||
init
|
||||
' MsgBox "helloworld"
|
||||
adjustment_sheet_last_row = getAdjustmentSheetListEnd(adjustment_sheet_first_row)
|
||||
Debug.Print adjustment_sheet_last_row
|
||||
|
||||
For adjustment_sheet_current_row = adjustment_sheet_first_row To adjustment_sheet_last_row
|
||||
Debug.Print "processing adjustment_sheet_current_row: " & adjustment_sheet_current_row
|
||||
|
||||
' if (CheckIfBalanceSheetAmountToAdjust2Exist(adjustment_sheet_current_row) and CheckIfBalanceSheetNa2Exist(adjustment_sheet_current_row) and CheckIfBalanceSheetPcco2Exist(adjustment_sheet_current_row)) then
|
||||
If (CheckIfAdjustmentSheetBmfIdValid(adjustment_sheet_current_row)) Then
|
||||
Debug.Print "processing row: " & adjustment_sheet_current_row
|
||||
|
||||
Dim bmf_id As String
|
||||
bmf_id = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim bal_pcco_1 As String
|
||||
bal_pcco_1 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim bal_pcco_2 As String
|
||||
bal_pcco_2 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim off_bal_pcco_1 As String
|
||||
off_bal_pcco_1 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim off_bal_pcco_2 As String
|
||||
off_bal_pcco_2 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim bal_pcec_1 As String
|
||||
bal_pcec_1 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCEC_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim bal_pcec_2 As String
|
||||
bal_pcec_2 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCEC_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim off_bal_pcec_1 As String
|
||||
off_bal_pcec_1 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCEC_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
Dim off_bal_pcec_2 As String
|
||||
off_bal_pcec_2 = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCEC_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
|
||||
' balance sheet 1
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
If (CheckIfBalanceSheetAmountToAdjust1NoNeedCopy(adjustment_sheet_current_row, bmf_id, bal_pcco_1) = True) Then
|
||||
' do skip
|
||||
Debug.Print "skip balance sheet 1"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
Debug.Print "bmf_adjustment_sheet_current_row:" & bmf_adjustment_sheet_current_row
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "E"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "01"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE & CStr(bmf_adjustment_sheet_current_row)).Value = "DQ"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_COMMENT & CStr(bmf_adjustment_sheet_current_row)).Value = "Unsettled bond adjustment for RWA purpose"
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCEC_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
' Selection.NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
' balance sheet 2
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
Debug.Print bal_pcco_2
|
||||
If (CheckIfBalanceSheetAmountToAdjust2NoNeedCopy(adjustment_sheet_current_row, bmf_id, bal_pcco_2)) Then
|
||||
' do skip
|
||||
Debug.Print "skip balance sheet 2"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "E"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "01"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE & CStr(bmf_adjustment_sheet_current_row)).Value = "DQ"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_COMMENT & CStr(bmf_adjustment_sheet_current_row)).Value = "Unsettled bond adjustment for RWA purpose"
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_PCEC_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_BALANCE_SHEET_NA_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
End If
|
||||
|
||||
' off-balance sheet 1
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
If (CheckIfOffBalanceSheetAmountToAdjust1NoNeedCopy(adjustment_sheet_current_row, bmf_id, off_bal_pcco_1)) Then
|
||||
' do skip
|
||||
Debug.Print "skip off-balance sheet 1"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "E"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "01"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE & CStr(bmf_adjustment_sheet_current_row)).Value = "DQ"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_COMMENT & CStr(bmf_adjustment_sheet_current_row)).Value = "Unsettled bond adjustment for RWA purpose"
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCEC_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_NA_1 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
End If
|
||||
|
||||
' off-balance sheet 2
|
||||
' check need to copy ? see amount to adjust <> 0 ?
|
||||
If (CheckIfOffBalanceSheetAmountToAdjust2NoNeedCopy(adjustment_sheet_current_row, bmf_id, off_bal_pcco_2)) Then
|
||||
' do skip
|
||||
Debug.Print "skip off-balance sheet 2"
|
||||
Else
|
||||
' do copy
|
||||
bmf_adjustment_sheet_last_row = getBMFAdjustmentResultListEnd(1)
|
||||
bmf_adjustment_sheet_current_row = bmf_adjustment_sheet_last_row + 1
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_FINAL_BMF_ID & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_BMF_REFERENCE_ID & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "14004"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_OPAQUE_REPORTING_ENTITY & CStr(bmf_adjustment_sheet_current_row)).Value = "N"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_INTERNAL_EXTERNAL_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "E"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_IFRS_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_FRENCH_GAAP_NORM_FLAG & CStr(bmf_adjustment_sheet_current_row)).Value = "Y"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_LIQ & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_STT & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PROCESS_IMPACTED_YLD & CStr(bmf_adjustment_sheet_current_row)).Value = "1"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_TYPE_CODE & CStr(bmf_adjustment_sheet_current_row)).Value = "01"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_ADJUSTMENT_TYPE & CStr(bmf_adjustment_sheet_current_row)).Value = "DQ"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_COMMENT & CStr(bmf_adjustment_sheet_current_row)).Value = "Unsettled bond adjustment for RWA purpose"
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCCO_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCCO & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_PCEC_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_PCEC & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_AMOUNT_TO_ADJ_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value
|
||||
|
||||
temp_value = Worksheets(ADJUSTMENT_WORKSHEET).Range(COL_OFF_BALANCE_SHEET_NA_2 & CStr(adjustment_sheet_current_row)).Value
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_LOCAL_OPERATIONAL_ACCOUNT & CStr(bmf_adjustment_sheet_current_row)).Value = temp_value & " " & "15130"
|
||||
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range("A" & bmf_adjustment_sheet_current_row & ":" & "BN" & bmf_adjustment_sheet_current_row).NumberFormat = "@"
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_ACCT_BALANCE & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
Worksheets(BMF_ADJUSTMENT_WORKSHEET).Range(COL_BMF_ADJUSTMENT_SHEET_AMOUNT_IN_FUNT & bmf_adjustment_sheet_current_row).NumberFormat = RED_THOUSAND_SEP_NUMBER_FORMAT
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
Debug.Print adjustment_sheet_current_row & " skipping copy as bmfid is empty"
|
||||
End If
|
||||
|
||||
|
||||
Next adjustment_sheet_current_row
|
||||
|
||||
Done:
|
||||
Exit Sub
|
||||
|
||||
eh:
|
||||
Debug.Print "helloworld:Error: " & Err.Description
|
||||
|
||||
End Sub
|
BIN
task3/delivery1/Copy and paste requirement.docx
Normal file
BIN
task3/delivery1/Copy and paste requirement.docx
Normal file
Binary file not shown.
35
task3/delivery1/notes.md
Normal file
35
task3/delivery1/notes.md
Normal file
@@ -0,0 +1,35 @@
|
||||
係"BMF Adjustment"入面...
|
||||
|
||||
1. If "BMF 1690 2680" tab 嘅 "NA" is 1690/2690 —> "Line type" 填 Reversing
|
||||
2. If "BMF 1690 2680" tab 嘅 "NA" is 1020/2020/8601/8701 —> "Line type" 填 Creation
|
||||
3. Columns Highlight in yellow 填嘅資料都一樣, refer to following photo
|
||||
4. 係"BMF 1690 2690"入面...
|
||||
Copy corresponding data in "BMF 1690 2690" to corresponding column in "BMF Adjustment"
|
||||
|
||||
|
||||
|
||||
1. If "Raw Data" tab 嘅 "NA" is 1690/2690 —> "Line type" 填 Reversing
|
||||
2. If "Raw Data" tab 嘅 "NA" is 1020/2020/8601/8701 —> "Line type" 填 Creation
|
||||
3. Columns Highlight in yellow 填嘅資料都一樣, refer to following photo
|
||||
|
||||

|
||||

|
||||
|
||||
"BMF 1690 2690" | To | "BMF Adjustment"
|
||||
--------------------------|----|-----------------------------------------------------
|
||||
BMF ID (Column C) | | BMF reference ID (Column A)
|
||||
PCCO (Column E) | | PCCO (Column G)
|
||||
PCEC (Column F) | | PCEC (Column H)
|
||||
Amount in acct (Column M) | | Amount in acct balance, Amount in funt (Column J, K)
|
||||
NA (Column H) | | Local Operational Account (Column BN) + 15130
|
||||
|
||||
|
||||
|
||||
Hello~ 唔知你仲記唔記得上次搵你幫我做嗰個vba係做啲咩呢
|
||||
今次同上次個做嘅野一樣,但多咗一個tab想你幫我copy 啲data去返嗰個tab,同埋加多咗一個要求
|
||||
|
||||
我改咗你original 個 vba少少,所以我send我改咗嗰version + 新要求 + excel file 俾你睇先吖🙇🏻♀️🙇🏻♀️
|
||||
|
||||
咁呀,有冇可能之後你得閒開個 call 講講你想點做?
|
||||
sor 有小許蠢睇唔明 👉👈
|
||||
|
35
task3/notes.md
Normal file
35
task3/notes.md
Normal file
@@ -0,0 +1,35 @@
|
||||
係"BMF Adjustment"入面...
|
||||
|
||||
1. If "BMF 1690 2680" tab 嘅 "NA" is 1690/2690 —> "Line type" 填 Reversing
|
||||
2. If "BMF 1690 2680" tab 嘅 "NA" is 1020/2020/8601/8701 —> "Line type" 填 Creation
|
||||
3. Columns Highlight in yellow 填嘅資料都一樣, refer to following photo
|
||||
4. 係"BMF 1690 2690"入面...
|
||||
Copy corresponding data in "BMF 1690 2690" to corresponding column in "BMF Adjustment"
|
||||
|
||||
|
||||
|
||||
1. If "Raw Data" tab 嘅 "NA" is 1690/2690 —> "Line type" 填 Reversing
|
||||
2. If "Raw Data" tab 嘅 "NA" is 1020/2020/8601/8701 —> "Line type" 填 Creation
|
||||
3. Columns Highlight in yellow 填嘅資料都一樣, refer to following photo
|
||||
|
||||

|
||||

|
||||
|
||||
"BMF 1690 2690" | To | "BMF Adjustment"
|
||||
--------------------------|----|-----------------------------------------------------
|
||||
BMF ID (Column C) | | BMF reference ID (Column A)
|
||||
PCCO (Column E) | | PCCO (Column G)
|
||||
PCEC (Column F) | | PCEC (Column H)
|
||||
Amount in acct (Column M) | | Amount in acct balance, Amount in funt (Column J, K)
|
||||
NA (Column H) | | Local Operational Account (Column BN) + 15130
|
||||
|
||||
|
||||
|
||||
Hello~ 唔知你仲記唔記得上次搵你幫我做嗰個vba係做啲咩呢
|
||||
今次同上次個做嘅野一樣,但多咗一個tab想你幫我copy 啲data去返嗰個tab,同埋加多咗一個要求
|
||||
|
||||
我改咗你original 個 vba少少,所以我send我改咗嗰version + 新要求 + excel file 俾你睇先吖🙇🏻♀️🙇🏻♀️
|
||||
|
||||
咁呀,有冇可能之後你得閒開個 call 講講你想點做?
|
||||
sor 有小許蠢睇唔明 👉👈
|
||||
|
12
task4/.editorconfig
Normal file
12
task4/.editorconfig
Normal file
@@ -0,0 +1,12 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = latin1
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
BIN
task4/dist/Expense_Report.xlsm
vendored
Normal file
BIN
task4/dist/Expense_Report.xlsm
vendored
Normal file
Binary file not shown.
BIN
task4/dist/step.png
(Stored with Git LFS)
vendored
Normal file
BIN
task4/dist/step.png
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
task4/from_client/Expense Report_original.xlsx
Normal file
BIN
task4/from_client/Expense Report_original.xlsx
Normal file
Binary file not shown.
0
task4/notes.md
Normal file
0
task4/notes.md
Normal file
BIN
task4/source/_del/Expense_Report_draft_001.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_draft_001.xlsm
Normal file
Binary file not shown.
BIN
task4/source/_del/Expense_Report_draft_002.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_draft_002.xlsm
Normal file
Binary file not shown.
BIN
task4/source/_del/Expense_Report_error.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_error.xlsm
Normal file
Binary file not shown.
BIN
task4/source/_del/Expense_Report_trunk - draft003.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_trunk - draft003.xlsm
Normal file
Binary file not shown.
BIN
task4/source/_del/Expense_Report_trunk - draft004.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_trunk - draft004.xlsm
Normal file
Binary file not shown.
BIN
task4/source/_del/Expense_Report_trunk - draft005.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_trunk - draft005.xlsm
Normal file
Binary file not shown.
BIN
task4/source/_del/Expense_Report_trunk - fast_draft001.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_trunk - fast_draft001.xlsm
Normal file
Binary file not shown.
BIN
task4/source/_del/Expense_Report_trunk copy.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_trunk copy.xlsm
Normal file
Binary file not shown.
BIN
task4/source/_del/Expense_Report_trunk.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_trunk.xlsm
Normal file
Binary file not shown.
BIN
task4/source/_del/Expense_Report_trunk_o.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_trunk_o.xlsm
Normal file
Binary file not shown.
BIN
task4/source/_del/Expense_Report_working.xlsm
Normal file
BIN
task4/source/_del/Expense_Report_working.xlsm
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user