asked on
Dim BaseWks As Worksheet, lastrow As Long, n As Integer
Dim wkb As Workbook, rngTarget As Excel.Range
Set wkb = ThisWorkbook
Set BaseWks = ActiveSheet
lastrow = BaseWks.UsedRange.Rows.Count - BaseWks.UsedRange.Row + 1
Set rngTarget = Range(BaseWks.Cells(1), BaseWks.Cells(lastrow, 1))
rngTarget.FormulaR1C1 = "= VLookup(RC[1], 'GL Summary'!Ranges, 2, False)"
Set rngTarget = Range(BaseWks.Cells(1), BaseWks.Cells(lastrow, 1))
rngTarget.FormulaR1C2 = "= VLookup(RC[2], 'GL Summary'!Ranges, 3, False)"
Range("A1:E1") = Split("Branch, Category, GL ID,Sum of Debt,Sum of Credit", ",")
BaseWks.Columns.AutoFit