Hey,
got a problem with this piece of code. I'm trying to insert SUMIFS formula to worksheet cell and I'm missing one quote marks of the last criteria. The last part of the code (underlined & bold) is not working. If I have the code like this:
Ws1.Range("J" & Row + 3).Formula = "=sumifs(J11:J" & Row + 2 & ", $I$11:$I$" & Row + 2 & ",""Text1"",$D$11:$D$" & Row + 2 & ", " & Ws1.Range("D" & Row) & ")"
Then when checking the formula from worksheet this last criteria (underlined & bold) brings the correct text string to worksheet formula but it doesn't have quote marks around the text string (like the hardcoded Text1 has). If I have the formula like this:
Ws1.Range("J" & Row + 3).Formula = "=sumifs(J11:J" & Row + 2 & ", $I$11:$I$" & Row + 2 & ",""Text1"",$D$11:$D$" & Row + 2 & ", "" & Ws1.Range("D" & Row) & "")"
Then the formula won't have the correct text string as criteria but this cell reference is showing up in the worksheet formula. So how this cell reference criteria should be handled...?
edit. Just after posting got it, needs to be like this:
Ws1.Range("J" & Row + 3).Formula = "=sumifs(J11:J" & Row + 2 & ", $I$11:$I$" & Row + 2 & ",""Text1"",$D$11:$D$" & Row + 2 & ", " & Ws1.Range("D" & Row).address & ")"
Bookmarks