Neha
Neha

Reputation: 50

SUMIF formula workbook name is unknown

I have to read to use SUMIF to check and compare the supplier number from different workbooks and if it is same then copy the Prices(using SUMIF). Everytime time the workbook can be different from which I take the prices but the sheet names and their layout will be same.So how can I write the formula in SUMIF? Can anyone help me please? I'm stuck with this code since 2 days but couldn't figure out whats wrong.

    Windows(wb_name).Activate
    Range("AW18", Range("AW18").Offset(0, -44).End(xlDown).Offset(0, 44)).Formula = _
    "=SUMIF('[" & dest_name & "]" & "!" & "Cu Part PVO L",$M$10:$M$2000,C19, _
    "[" & dest_name & "]" & "Cu Part PVO L" & "'" & "!",$AD$10:$AD$2000)"

Upvotes: 0

Views: 72

Answers (1)

luke_t
luke_t

Reputation: 2985

It looks like you have the exclamation mark in the wrong place, as well as also having too many commas.

   Range("AW18", Range("AW18").Offset(0, -44).End(xlDown).Offset(0, 44)).Formula = _
    "=SUMIF('[" & dest_name & "]Cu Part PVO L'!$M$10:$M$2000,C19," & _
    "'[" & dest_name & "]Cu Part PVO L'!$AD$10:$AD$2000)"

Upvotes: 1

Related Questions