Hi, I am creating a macro using worksheet function sumifs.
There are 3 col : brand name , purchase value & date.
I need to extract sum of purchase value based on brand name and start & end date.My procedure is as below:
Sub GenerateReport()
Dim fromDt As String
Dim toDt As String
Dim brand As String
brand = InputBox("Enter Brand")
fromDt = InputBox("Enter From Date", "yyyy-mm-dd")
toDt = InputBox("Enter To Date", "yyyy-mm-dd")
Range("e2").Value = brand
Range("e5").Value = fromDt + " To " + toDt
Range("E3").Value = WorksheetFunction.SumIfs(Sheet2.Range("K:K"), Sheet2.Range("H:H"), ">=" & fromDt, Sheet2.Range("H:H"), "<=" & toDt, Sheet2.Range("A:A"), brand)
End Sub
Is there anything that im missing out as the function is not giving me the result.
Thanks in advance.
Sheetal
Bookmarks