VBA Autofill or Formula Range

Littlemalky

Board Regular
Joined
Jan 14, 2011
Messages
223
I'm struggling with this, I have a weird range I'm working with to insert a formula, and I'm trying to autofill it down, or maybe there is a way to just set the range in the formula to filldown. Basically, I need the formula to filldown from the 5th row to the 27th row on the sheet. The column part is dynamic, and the formula is a VLOOKUP looking at Column A. Here is my formula, but I'm struggling to fill it down to the 27th row.
Code:
Workbooks("" & Format(DateSerial(Year(Date), (Month(Date) - 1), Day(Date)), "yyyy.mm") & " summary.xlsx").Worksheets("Domestic").Range("A5").End(xlToRight).Offset(0, 1).Formula = _
        "=IFERROR(VLOOKUP(A:A,'[" & Format(DateSerial(Year(Date), (Month(Date) - 1), Day(Date)), "mm-yyyy") & " Domestic.xlsx]Summary'!$A:$D,4,0),0)"
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,224,594
Messages
6,179,795
Members
452,943
Latest member
Newbie4296

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