Good Day Ma'am/Sir.
I am making a code for which i have a worksheet 2columns Dates,Sales.
I want to make a userform which i can choose years in combobox and
display and sum all the sales within each month in the list box.
I manage to find a tutorial but it has some minor issue. it display only the month and all 0
Heres the code:
heres the pic.
https://drive.google.com/open?id=1xQhXCg0WuLCeN9Z-zfRfWgXJ1YuaK4cm
Thank You
I am making a code for which i have a worksheet 2columns Dates,Sales.
I want to make a userform which i can choose years in combobox and
display and sum all the sales within each month in the list box.
I manage to find a tutorial but it has some minor issue. it display only the month and all 0
Heres the code:
Private Sub UserForm_Initialize()
For i = 0 To 3
Me.ComboBox1.AddItem Format(Date, "YYYY") - i
Next i
Me.ComboBox1.Value = Format(Date, "YYYY")
End Sub
Private Sub ComboBox1_Change()
Me.ListBox1.Clear
For i = 0 To 11
A = Application.WorksheetFunction.EDate("1" & "/" & "January" & "/" & Me.ComboBox1.Value, i)
B = Application.WorksheetFunction.EoMonth("1" & "/" & "January" & "/" & Me.ComboBox1.Value, i)
Me.ListBox1.AddItem Format(A, "MMMM")
Me.ListBox1.List(ListBox1.ListCount - 1, 1) = Application.WorksheetFunction.SumIfs _
(Sheet1.Range("B:B"), Sheet1.Range("A:A"), _
">=" & A, Sheet1.Range("A:A"), "<=" & B)
Next i
End Sub
heres the pic.
https://drive.google.com/open?id=1xQhXCg0WuLCeN9Z-zfRfWgXJ1YuaK4cm
Thank You