Why is the code below giving me the wrong answer. In the formula line, if I
just use J1 I get the right answer. When I use var1 (which is set as J1), it
gives the wrong answer. ???
Private Sub CommandButton1_Click()
Dim Ans1 As Range
Dim var1 As Range
Dim WS As Worksheet
Set WS = Worksheets("Sheet1")
Set Ans1 = WS.Range("h2")
Set var1 = WS.Range("J1")
Ans1.Value = Worksheets("sheet1").Evaluate("=SUMPRODUCT((A1:A10="" &
var1 & "")*(B1:B10=k1))")
End Sub
--
Thanks
Shawn
Bookmarks