I have this formula on sheet SUMPRODUCT(--(MONTH(Venda!$L$3:$L$5000)=MONTH($A9)); --(YEAR(Venda!$L$3:$L$5000)=YEAR($A9)); Venda!M3:M5000), it´s works fine but I have to translate to VBA code.
I have been tried
Sheets("Venda").Select
Range("A3").Select
Lastcl = Cells(Rows.Count, "A").End(xlUp).Row
TotParcPrev1 = Application.SumProduct(--Sheets("Venda").Range(Month("L3:L" & Lastcl)) = Month(tempdata), --Sheets("Venda").Range(Year("L3:L" & Lastcl)) = Year(tempdata), Sheets("Venda").Range("M3:M" & Lastcl)), but the total is empty. When I used evaluate, give the error 2015.
Maybe I´m making something wrong.
Thanks in advance
I have been tried
Sheets("Venda").Select
Range("A3").Select
Lastcl = Cells(Rows.Count, "A").End(xlUp).Row
TotParcPrev1 = Application.SumProduct(--Sheets("Venda").Range(Month("L3:L" & Lastcl)) = Month(tempdata), --Sheets("Venda").Range(Year("L3:L" & Lastcl)) = Year(tempdata), Sheets("Venda").Range("M3:M" & Lastcl)), but the total is empty. When I used evaluate, give the error 2015.
Maybe I´m making something wrong.
Thanks in advance