View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_2666_] Rick Rothstein \(MVP - VB\)[_2666_] is offline
external usenet poster
 
Posts: 1
Default sumproduct/evaluate

You had an extra space in at the first '--(H1:H ' and were missing an H in
the last ',H1:' and had the ending parenthesis handled wrongly also. I think
this is probably what you want...

Cells(1, 1).Formula = "=SUMPRODUCT(--(a1:A" & lstrow & "),--(H1:H" & _
lstrow & "<0.0215277777777778),H1:H" & lstrow & ")"

I used the line continuation character to control the break point... you can
remove it and rejoin the two lines if you want to have the statement all on
one line.

Rick


"T" wrote in message
...
Hello.. I've tried using both of the following & neither work. Can anyone
help? The first doesn't do anything and the second returns a Value error.

For i = 1 To lstRow - 1
If Cells(i, 1).Value < Cells(i + 1, 1).Value Then
Cells(i + 1, 9).Formula = "=SUMPRODUCT(--(a1:A" & lstRow & "),--(H1:H "
& lstRow & "< 0.0215277777777778),H1: & lstrow)"

Else 'nothing

End If

Next i

For i = 1 To lstRow - 1
If Cells(i, 1).Value < Cells(i + 1, 1).Value Then
Cells(i + 1, 9).Formula = evaluate("SUMPRODUCT(--(a1:A" & lstRow &
"),--(H1:H " & lstRow & "< 0.0215277777777778),H1: & lstrow)")

Else 'nothing

End If

Next i
--
Thanks in advance!
T