B
baha
Hi Everyone,
I have a data page in which column AD is the Id# Of the product,
column AC is the location code, and column R is the cost.Without
creating a filter I want to know total sales, for each product in
different location. I type a code seems like not working. Any jhelp?
Here is my code:
Code:
Sub SumByArea()
Dim cel As Range
Dim totbet, ibet As Variant
For Each cel In Worksheets("Sheet1").Range("AD2:AD50000")
If cel <> "" And IsNumeric(cel) Then
cel.Offset(0, 30) = Application.WorksheetFunction.SumProduct(--
(Sheets("Sheet1").Range("A2:A50000") = cel.Value), --
(Sheets("Sheet1").Range("AC2:AC50000") > 750),
(Sheets("Sheet1").Range("S2:S50000")))
End If
Next cel
End Sub
I have a data page in which column AD is the Id# Of the product,
column AC is the location code, and column R is the cost.Without
creating a filter I want to know total sales, for each product in
different location. I type a code seems like not working. Any jhelp?
Here is my code:
Code:
Sub SumByArea()
Dim cel As Range
Dim totbet, ibet As Variant
For Each cel In Worksheets("Sheet1").Range("AD2:AD50000")
If cel <> "" And IsNumeric(cel) Then
cel.Offset(0, 30) = Application.WorksheetFunction.SumProduct(--
(Sheets("Sheet1").Range("A2:A50000") = cel.Value), --
(Sheets("Sheet1").Range("AC2:AC50000") > 750),
(Sheets("Sheet1").Range("S2:S50000")))
End If
Next cel
End Sub