tanyaleblanc
Board Regular
- Joined
- Mar 16, 2019
- Messages
- 145
Hi, each month I run a report and complete multiple Vlookups against last months report through VBA. The reports are called the same thing, example - April folder - Finance extract, May folder - Finance extract. In order for my macros to work, I have to each month rename the previous month file to something else as Excel can't open two files with the same name. So I just change the file name to Finance Extract1, but is there a way that I can do this without opening the file and renaming the previous month file, each month when running my macros,
Code:
[CODE][Windows("Rental Extract.xls").Activate lastrow = Cells(Rows.Count, "J").End(xlUp).Row
With ActiveSheet
.AutoFilterMode = False
Range("F11").Select ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[2],'[Rental Extract1.xls]Sheet1'!R11C8:R15000C14,7,FALSE)"
Selection.AutoFill Destination:=Range("F11:F15000")
Range("F11:F15000").Select
Range("F11").Select
Range(Selection, Selection.End(xlDown)).Select]