Professional Documents
Culture Documents
Sheets("Payments_Today").Range("C1").Value = 0
Sheets("Payments_Today").Range("D1").Value = 0
Cancel = True
Application.CutCopyMode = False
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
Range("J7:J106").ClearContents
Range("D6:E" & nFinalRow).Copy Destination:=Range("K6")
Sheets("GL").Range("A6").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("K6:L" & nFinalRow), _
CopyToRange:=Range("E6:I6"), _
Unique:=True
Sheets("GL").Range("A6").CurrentRegion.AutoFilter
Call update_formats_payments_today
Range("D1").Value = 1
Range("E7").Select
ActiveWindow.ScrollRow = 1
Application.CutCopyMode = False
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
Application.ScreenUpdating = False
Application.EnableEvents = False
Range("J7:J106").ClearContents
Range("D6:E" & nFinalRow).Copy Destination:=Range("K6")
Sheets("GL").Range("A6").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("K6:L" & nFinalRow), _
CopyToRange:=Range("E6:I6"), _
Unique:=True
Call update_formats_payments_today
Range("C1").Value = 0
Range(cAddress).Select
End If
If Not Intersect(Target, Range("G7:I" & nFinalRow)) Is Nothing Then
cAddress = Selection.Address
Call update_beneficiaries
Call update_formats_payments_today
Range("C1").Value = 0
Range(cAddress).Select
End If
Call update_beneficiaries
Call update_formats_payments_today
Range(cAddress).Select
End If
End If
Application.CutCopyMode = False
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Sub set_sub_totals_GL()
Set rg = Range("A6").CurrentRegion
rg.Sort Key1:=Range("C7"), Key2:=Range("H7"), Order1:=xlAscending, Order2:=xlDescending, Header:=xlYes
ActiveSheet.Outline.ShowLevels RowLevels:=2
Range("A6").CurrentRegion.SpecialCells(xlCellTypeVisible).Font.Bold = True
With Range("A6").CurrentRegion.SpecialCells(xlCellTypeVisible).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.149998474074526
.PatternTintAndShade = 0
End With
ActiveSheet.Outline.ShowLevels RowLevels:=3
ActiveSheet.ShowAllData
Range("A6").CurrentRegion.ClearOutline
Range("C6").Select
Columns("C:C").NumberFormat = "General"
Range("A2").Value = 1
'Application.ScreenUpdating = True
End If
End Sub
Sub update_beneficiaries()
Application.Calculation = xlCalculationManual
Set rg = Sheets("Beneficiaries").Range("Table1[#All]")
rg.Sort Key1:=Sheets("Beneficiaries").Range("A5"), Order1:=xlAscending, Header:=xlYes
Application.Calculation = xlCalculationAutomatic
End Sub
Sub Update_data_2()
Sheets("Payments_Today").Range("A1").Value = 1
Sheets("Payments_Today").Range("C1").Value = 1
Sheets("GL").Select
Range("A6").AutoFilter
Range("A6").AutoFilter
ActiveSheet.ShowAllData
Call get_Items_Data
Call get_Exchange_Rate_Data
Call get_Selected_GL
Call get_Suppliers
Application.Calculation = xlCalculationAutomatic
Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.ScreenUpdating = True
'End If
Application.ScreenUpdating = False
Call set_GL
Application.ScreenUpdating = True
End If
End Sub
Sub Update_data_1()
Sheets("GL").Select
Range("A6").AutoFilter
Range("A6").AutoFilter
ActiveSheet.ShowAllData
Call get_Items_Data
Call get_Exchange_Rate_Data
Call get_Selected_GL
Call get_Suppliers
Application.Calculation = xlCalculationAutomatic
Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.ScreenUpdating = True
'End If
Application.ScreenUpdating = False
Call set_GL
Application.ScreenUpdating = True
End Sub
Sub get_Suppliers()
Set rg = Sheets("Beneficiaries").Range("Table1[#All]")
rg.Sort Key1:=Sheets("Beneficiaries").Range("A5"), Order1:=xlAscending, Header:=xlYes
End Sub
Sub get_Items_Data()
End Sub
Sub get_Exchange_Rate_Data()
End Sub
Sub Clean_data()
End Sub
Sub get_Selected_GL()
Call Clean_data
ActiveSheet.Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=ReportWB.Sheets("Criteria").Range("G4:R4")
Call Delete_Names
SourceWB.Close False
Application.Calculation = xlCalculationAutomatic
Sheets("Criteria").Range("S5:Y5").Copy Destination:=Sheets("Criteria").Range("S5:Y" & FinalRowData)
If Sheets("Payments_Today").Range("A1").Value = 1 Then
Dim nFinalRow As Integer
nFinalRow = Sheets("Payments_Today").Cells(Rows.Count, 5).End(xlUp).Row
Sheets("Criteria").Range("G4").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Payments_Today").Range("D6:E" & nFinalRow), _
CopyToRange:=Sheets("GL").Range("A6:R6")
Sheets("Payments_Today").Range("D6:E" & nFinalRow).Copy Destination:=Sheets("Payments_Today").Range("K6")
Sheets("Payments_Today").Range("F7:F" & nFinalRow).Copy Destination:=Sheets("Payments_Today").Range("N7")
Sheets("Criteria").Range("G4").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Payments_Today").Range("K6:L" & nFinalRow), _
CopyToRange:=Sheets("Payments_Today").Range("E6:I6"), _
Unique:=True
Sheets("Payments_Today").Range("G7:I106").FormatConditions.Delete
Sheets("Payments_Today").Range("L3").Copy
Sheets("Payments_Today").Range("E7:E106").PasteSpecial Paste:=xlPasteFormats
Sheets("Payments_Today").Range("G3:I3").Copy
Sheets("Payments_Today").Range("G7:I" & nFinalRow).PasteSpecial Paste:=xlPasteFormats
Sheets("Payments_Today").Range("J1").Copy Destination:=Sheets("Payments_Today").Range("J7:J" & nFinalRow)
Sheets("Payments_Today").Range("J7:J" & nFinalRow).Copy
Sheets("Payments_Today").Range("J7:J" & nFinalRow).PasteSpecial Paste:=xlPasteValues
Sheets("Payments_Today").Range("N1").Copy Destination:=Sheets("Payments_Today").Range("N7:N" & nFinalRow)
Sheets("Payments_Today").Range("E7").Copy
Sheets("Payments_Today").Range("E7").PasteSpecial Paste:=xlPasteValues
Else
If n = 1 Then ' Laptop Adi
Sheets("Criteria").Range("G4").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Criteria").Range("A4").CurrentRegion, _
CopyToRange:=Sheets("GL").Range("A6:R6")
Else ' Laptop Others
Sheets("Criteria").Range("G4").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("GL").Range("A6:R6")
End If
End If
Range("A6").CurrentRegion.Rows.AutoFit
Call Delete_Names
End If
End Sub
Sub set_GL()
Sheets("Criteria").Range("G6:Y20000").Clear
Range("F4").Value = "(All)"
ActiveSheet.ShowAllData
Call set_sub_totals_GL
ActiveSheet.ShowAllData
ActiveSheet.ShowAllData
Range("A6").AutoFilter
End Sub
Sub update_formats_payments_today()
Range("L3").Copy
Range("E7:E106").PasteSpecial Paste:=xlPasteFormats
Range("G7:I106").FormatConditions.Delete
Range("G3:I3").Copy
Range("G7:I" & nFinalRow).PasteSpecial Paste:=xlPasteFormats
Range("J1").Copy Destination:=Range("J7:J" & nFinalRow)
Range("J7:J" & nFinalRow).Copy
Range("J7:J" & nFinalRow).PasteSpecial Paste:=xlPasteValues
Range("N1").Copy Destination:=Range("N7:N" & nFinalRow)
End Sub
Sub create_files_PDF()
'Create folder
FolderName = ThisWorkbook.Path & "\" & "Print_PDF"
'FolderName = "D:\Dropbox\RutgersWPF\REPORTS_2021\Print_2021\Print_PDF"
MkDir FolderName
'Sheets("Voucher").Visible = False
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
Sub add_all_to_payments()
Application.ScreenUpdating = False
Call clear_payments
Sheets("GL").Range("A6").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Criteria").Range("E4:E5"), _
CopyToRange:=Sheets("_payments").Range("A3:E3"), _
Unique:=True
Sheets("Payments").Cells.FormatConditions.Delete
FinalRowPaymentsData1 = Sheets("_payments").Cells(Rows.Count, 1).End(xlUp).Row
If FinalRowPaymentsData1 > 3 Then
Sheets("_payments").Range("F1:V1").Copy
Sheets("_payments").Range("F4:V" & FinalRowPaymentsData1).PasteSpecial Paste:=xlPasteAll, SkipBlanks:=True
FinalRowPaymentsData2 = FinalRowPaymentsData1 - 3
Sheets("_formats").Range("A2:N2").Copy
Sheets("Payments").Range("A1:N" & FinalRowPaymentsData2).PasteSpecial Paste:=xlPasteFormats
Sheets("_payments").Range("I4:V" & FinalRowPaymentsData1).Copy
Sheets("Payments").Range("A1").PasteSpecial Paste:=xlPasteValues
End If
Sheets("Payments").Select
Application.CutCopyMode = False
Application.ScreenUpdating = True
End If
End Sub
Sub clear_payments()
Sheets("_payments").Rows("4:10000").Clear
Sheets("Payments").Cells.Clear
Sheets("Lookups").Range("Y2:Y10000").ClearContents
Sheets("Payments").Cells.FormatConditions.Delete
End Sub
Sub clear_payments_today()
Range("E7:L106").ClearContents
Range("G7:I106").FormatConditions.Delete
Range("E7").Select
End Sub
Sub Save_As_CSV_File()
cThisWorkbookPath = ThisWorkbook.Path
cTanggal = Sheets("GL").Range("M2").Value
ActiveWorkbook.SaveAs cThisWorkbookPath & "\" & "Bulk Payment " & cTanggal, FileFormat:=xlOpenXMLWorkbook
cPaymentFile = ActiveWorkbook
fileSaveName = Application.GetSaveAsFilename(InitialFileName:=cThisWorkbookPath & "\Bulk Payment " & cTanggal, _
fileFilter:="CSV Files (*.csv), *.csv")
If fileSaveName <> False Then
With ActiveWorkbook
.SaveAs FileName:=fileSaveName, FileFormat:=xlCSV, CreateBackup:=False, Local:=True
.Close False
End With
End If
cPaymentFile.Close False
Sheets("GL").Select
Application.DisplayAlerts = True
End If
End Sub
Sub Delete_Names()
Sub BreakLinks()
Dim wb As Workbook
Set wb = Application.ActiveWorkbook
If Not IsEmpty(wb.LinkSources(xlExcelLinks)) Then
For Each link In wb.LinkSources(xlExcelLinks)
wb.BreakLink link, xlLinkTypeExcelLinks
Next link
End If
End Sub