I have the below code, trying to update my Volume variable from a table in another workbook. The code returns an error, "Subscript out of range".
I presume my problem is how I have referred to the table on the MDF workbook, but I don't know how to reference it properly without activating the MDF workbook, running the SumIfs (without "Workbooks(MDF).", then re-activating the main workbook; which would be much slower.
Can anyone offer any help?
(The MDF variable is just a shorthand for the full filename)
I presume my problem is how I have referred to the table on the MDF workbook, but I don't know how to reference it properly without activating the MDF workbook, running the SumIfs (without "Workbooks(MDF).", then re-activating the main workbook; which would be much slower.
Can anyone offer any help?
(The MDF variable is just a shorthand for the full filename)
VBA Code:
Volume = Application.WorksheetFunction.SumIfs(Workbooks(MDF).Sheets("Vessels").Range("G3", "G" & VRows), _
Sheets("Vessels").Range("I3", "I" & VRows), Vintage, _
Sheets("Vessels").Range("J3", "J" & VRows), Label, _
Sheets("Vessels").Range("K3", "K" & VRows), Blend, _
Sheets("Vessels").Range("L3", "L" & VRows), Batch)