I am trying to get a dollar amount generated in this one sheet that comes from data in another workbook. I have multiple files and they each change in file name so I cant use the typical VLOOKUP(value, table, column, true/false) because the table name changes.
I am attempting this in VBA and would like to Loop it as I have multiple rows. How am I able to specify I want the vlookup to reference the other workbook that is currently open. Any way to do this?
As you can see from the macro recorder this won't work. I need this result, but without the file name. What is a general way to essentially activate the other workbook during the vlookup and point to that source of data? Or am I looking at something that just isn't possible.
I am attempting this in VBA and would like to Loop it as I have multiple rows. How am I able to specify I want the vlookup to reference the other workbook that is currently open. Any way to do this?
Code:
ActiveCell.FormulaR1C1 = _
"=IF(RC[-4]="""","""",VLOOKUP(CONCATENATE(RC[-5],RC[-4],R37C34),'[Alpena Hospital - Facility.xls]Sheet1'!R6C6:R247C7,2,FALSE))"
Range("AH38").Select
Selection.Style = "Currency"
As you can see from the macro recorder this won't work. I need this result, but without the file name. What is a general way to essentially activate the other workbook during the vlookup and point to that source of data? Or am I looking at something that just isn't possible.
Last edited: