Hello, I have the following code that I can't figure out how to adjust -
All I want to do is concatenate column A and column B and then parse that A:B as range into the SUMPRODUCT without having to express the concatenated range onto the worksheet . Currently nothing happens when code is run, what am I doing wrong?
VBA Code:
Sub SumData()
Dim HSArr(2 To 250) As Variant
Dim HSVal As Long
For HSVal = LBound(HSArr) To UBound(HSArr)
HSArr(HSVal) = Cells(HSVal, 1) & "_" & Cells(HSVal, 2)
Next HSVal
Const dFormula As String _
= "=IFERROR(SUMPRODUCT(--(HSArr=I2),D$2:D$250,F$2:F$250),"""")"
With ThisWorkbook.Worksheets("Sheet1").Range("K2:K250")
.Formula = dFormula
.Value = .Value
End With
End Sub
All I want to do is concatenate column A and column B and then parse that A:B as range into the SUMPRODUCT without having to express the concatenated range onto the worksheet . Currently nothing happens when code is run, what am I doing wrong?
Last edited: