I have a database workbook on C:\Users\user\documents which is always close.
The active sheet has the following code to update column C and D of invoice workbook which is the active sheet.
But on trigger , I am getting an open dialog box with update values looking for the file , each time I pressed the cancel key of dialog box, it updates one cell , the dialog box open , press cancel it update one cell by one cell.
Can anyone assist 
Sub JEANtest()
Dim i As Long, ws As Worksheet, y
Set ws = ActiveSheet
With ws
ReDim y(2 To .Range("B" & Rows.Count).End(3).Row)
For i = LBound(y) To UBound(y)
.Cells(i, "C").Formula = "=VLOOKUP(B" & i & ",'C:\Users\user\Documents\[database.xlsx]data BASE'!$B$2:$D$13,2,FALSE)"
.Cells(i, "D").Formula = "=VLOOKUP(B" & i & ",'C:\Users\user\[database.xlsx]data BASE'!$B$2:$D$13,3,FALSE)"
.Cells(i, "C").Resize(, 2).Value = .Cells(i, "C").Resize(, 2).Value
Next i
End With
End Sub
Bookmarks