Atikah Karimah
Atikah Karimah

Reputation: 23

SumIfs on VBA 2016

I made codes in Excel 2007 and it really went well. Then I reopened it in Excel 2016, but the value turns out to zero. I've tried to search the solution, but didn't find one. Can anyone help me?

Here's some of my codes:

Set today1 = Range("C2")
Set BeginWeek = Range("C5")
Set MilkTableP = Range("MilkTable[Total Plan]")
Set datemilk = Range("MilkTable[Date]")

Range("O1").Value = Application.WorksheetFunction.SumIfs _
        (MilkTableP, datemilk, ">=" & BeginWeek, _
        datemilk, "<" & today1)

Thank you so much

Upvotes: 2

Views: 59

Answers (1)

EvR
EvR

Reputation: 3498

Convert your date to long:

Range("O1").Value = Application.WorksheetFunction.SumIfs _
        (MilkTableP, datemilk, ">=" & BeginWeek, _
        datemilk, "<" & CLng(Today1))

Upvotes: 1

Related Questions