Hi everyone,
I got three columns for my spreadsheet.
column A is date in format of dd/mm/yyyy
column B is Customer name
column C is total sale for each customer.
I set up a userform to check total of sale for a customer from a certain date. for example I want to know how many items have been delivered to customer John from 04/11/2018.
My trouble is the code below not work properly. It did not pick up the correct date.
TextBox1 is where I enter the date. 4/11/2018
ComboBox1 is where I enter the customer name John
Could you please help to fix my code. Many thanks
Sub Sum_ifs()
Dim NumOfItem, Customer, DateRange As Range
Set NumOfItem = Range("C:C")
Set Customer = Range("B:B")
Set DateRange = Range("A:A")
S_date = UserForm1.TextBox1.Value
MsgBox WorksheetFunction.SumIfs(NumOfItem, Customer, UserForm1.ComboBox1, DateRange, ">=" & CDate(S_date))
End Sub
I got three columns for my spreadsheet.
column A is date in format of dd/mm/yyyy
column B is Customer name
column C is total sale for each customer.
I set up a userform to check total of sale for a customer from a certain date. for example I want to know how many items have been delivered to customer John from 04/11/2018.
My trouble is the code below not work properly. It did not pick up the correct date.
TextBox1 is where I enter the date. 4/11/2018
ComboBox1 is where I enter the customer name John
Could you please help to fix my code. Many thanks
Sub Sum_ifs()
Dim NumOfItem, Customer, DateRange As Range
Set NumOfItem = Range("C:C")
Set Customer = Range("B:B")
Set DateRange = Range("A:A")
S_date = UserForm1.TextBox1.Value
MsgBox WorksheetFunction.SumIfs(NumOfItem, Customer, UserForm1.ComboBox1, DateRange, ">=" & CDate(S_date))
End Sub