I am having problems evaluating a sumproduct function. I have created 6 arrays which I use in the sumproduct function but the evaluation turns up "empty" ("formula2" is empty). 5 out of the 6 arrays are logic vectors and the 6th contains values. All the arrays are the same length and contain no blanks or errors.
Any help would be appreciated.
Dim state As String
state = "MA"
state = Replace(state, Chr(34), vbNullString)
Dim r2 As Variant, r3 as variant, r4 as variant, r5 as variant, r6 as variant, r7 as variant, formula2 as variant
Set ra = wb.ActiveSheet.Range("a2").Resize(cntbnk)
Set rb = wb.ActiveSheet.Range("g2").Resize(cntbnk)
Set rc = wb.ActiveSheet.Range("a2").Offset(, m2).Resize(cntbnk)
r2 = Application.Evaluate("=transpose(if(" & ra.Address & "<>14,1,0))")
r3 = Application.Evaluate("=transpose(if(" & ra.Address & "<>35206,1,0))")
r4 = Application.Evaluate("=transpose(if(" & ra.Address & "<>18342,1,0))")
r5 = Application.Evaluate("=transpose(if(" & ra.Address & "<>24811,1,0))")
r6 = Application.Evaluate("=transpose(if(" & rb.Address & "=" & Chr(34) & state & Chr(34) & ",1,0))")
rc.Select
For Each cell In Selection
If cell.Value = "" Then
cell.Value = "0"
End If
Next cell
r7 = WorksheetFunction.Transpose(rc.Value)
formula2 = Application.Evaluate("=sumproduct(" & r2 & "," & r3 & "," & r4 & "," & r5 & "," & r6 & "," & r7 & ")")
Bookmarks