HI
I need a help with a macro
i need that "str1" and "str2" will note the hole string i need it to be part of the string in the cell
thanks
I need a help with a macro
Code:
Sub s_Product_CAPACITY()
Dim rng1 As String, rng2 As String, rng3 As String, mnth As String
Dim Str1 As String, str2 As String, spFormula As String
Dim res As Variant
Dim i As Integer
Dim H As Integer
k = 1
On Error GoTo fg
Y = Sheets("Year Count").Range("AD65536").End(xlUp).Row
fg:
For n = 2 To Y
k = k + 1
rng1 = "'year'!U2:U65536"
rng2 = "'year'!A2:A65536"
rng3 = "'year'!E2:E65536"
Str1 = Sheets("Year Count").cells(n, "AD").Value
str2 = Sheets("Year Count").cells(3, "Z").Value
spFormula = "SumProduct((" & rng1 & "=""" & Str1 & """)*(" & rng2 & "=""" & str2 & """)*(" & rng3 & "))"
res = Application.Evaluate(spFormula)
If Not IsError(res) Then Sheets("Year Count").cells(k, "AE").Value = res
Next n
End Sub
i need that "str1" and "str2" will note the hole string i need it to be part of the string in the cell
thanks