Vlookup from last months report for this months report

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]
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top