View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default sumproduct question

Do you mean

Range(OutReach) = WS.Evaluate("=SUMPRODUCT((" & AgeRange & "1)*(D1:F10="""
& Red.Value & """))")


--
HTH

Bob Phillips

"Shawn" wrote in message
...
Here is my code:

Option Explicit

Private Sub CommandButton1_Click()

Dim OutReach As String
Dim WS As Worksheet
Dim AgeRange As String
Dim Red As Range

Set WS = Worksheets("Sheet1")
OutReach = Worksheets("Sheet3").Range("A1").Value
Set Red = WS.Range("I1")
Conclusion = Worksheets("Sheet3").Range("B1").Value
AgeRange = "B1:B10"


" & OutReach & " = WS.Evaluate("=SUMPRODUCT((" & AgeRange &
"1)*(D1:F10=""" & Red.Value & """))")
End Sub


My intention is to place the formula in a looping macro. I want the
variable Outreach to be tied to the text that is in WS3.rng("A1") which,
during the loop will dynamically change. Ultimately, this formula will

put
the same answer in multiple desired places. However, the " & OutReach & "
part of the formula is kicking out saying it needs a line number or label.
If I just type Outreach, it gives me no value. What as I doing wrong?

--
Thanks
Shawn