I am trying to insert a formula that looks up cells in a different workbook. Can someone help me with my code below? I want the formula to be dynamic so as I do this next month and the file changes, I don't have to change the entire code with every line that has this formula, as a similar one will be inputted in multiple locations of my code.
Thanks!
![]()
Application.Workbooks.Open("C:\Documents\Book1.xlsx") wbkDataLoad = ActiveWorkbook Thisworkbook.Sheets("Sheet1").Range("A2").Activate ActiveCell.Formula = "=sumif(" & wbkDataLoad & "Sheet1'!$R$2:$R$100,$B2," & wbkDataLoad & "Sheet1'!$Z$2:$Z$100)"
Bookmarks