Littlemalky
Board Regular
- Joined
- Jan 14, 2011
- Messages
- 223
Is there anyway to make this more efficient. This is the only way I could get this problem to work: I'm inserting a formula into a cell I can't call upon directly because it's dynamic, and then I'm selecting the cell, copying that cell, and telling it to paste down in the next 23 rows below it.
It seems redundant to me, but I can't figure out anything else.
It seems redundant to me, but I can't figure out anything else.
Code:
Workbooks("" & Format(DateSerial(Year(Date), (Month(Date) - 1), Day(Date)), "yyyy.mm") & " summary.xlsx").Worksheets("Domestic").[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)"
Workbooks("" & Format(DateSerial(Year(Date), (Month(Date) - 1), Day(Date)), "yyyy.mm") & " summary.xlsx").Worksheets("Domestic").[A5].End(xlToRight).Select
Workbooks("" & Format(DateSerial(Year(Date), (Month(Date) - 1), Day(Date)), "yyyy.mm") & " summary.xlsx").Worksheets("Domestic").[A5].End(xlToRight).Copy _
Destination:=Workbooks("" & Format(DateSerial(Year(Date), (Month(Date) - 1), Day(Date)), "yyyy.mm") & " summary.xlsx").Worksheets("Domestic").Range(Selection, Selection.Cells(23))