' 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
