help pls. i cant move on my project.
kept on encountering this error, " Unable to get the EDate property of the WorksheetFunction class"
Here's the code.
Thank you!
kept on encountering this error, " Unable to get the EDate property of the WorksheetFunction class"
Here's the code.
Private Sub UserForm_Initialize()
Me.COMBOBOXYear.Value = Format(Date, "YYYY")
Me.COMBOBOXMonth.Value = Format(Date, "MMMM")
For a = 0 To 5
Me.COMBOBOXYear.AddItem Format(Date, "YYYY") - a
Next a
For b = 0 To 11
c = Application.WorksheetFunction.EoMonth("1" & "/" & "January" & "/" & Me.COMBOBOXYear.Value, b)
Me.COMBOBOXMonth.AddItem Format(c, "MMMM")
Next b
End Sub
Private Sub COMBOBOXYear_Change()
Me.LBOXSales.Clear
Me.LBOXSales.AddItem Sheet10.Cells(1, 1).Value
For a = 1 To 4
Me.LBOXSales.List(LBOXSales.ListCount - 1, a) = Sheet10.Cells(1, a + 1).Value
Next a
Me.LBOXSales.Selected(0) = True
For i = 2 To Application.WorksheetFunction.CountA(Sheet10.Range("A:A"))
b = Application.WorksheetFunction.EDate("1" & "/" & Me.COMBOBOXMonth.Value & "/" & Me.COMBOBOXYear, 0)
c = Application.WorksheetFunction.EoMonth("1" & "/" & Me.COMBOBOXMonth.Value & "/" & Me.COMBOBOXYear, 0)
If Sheet10.Cells(i, 1).Value >= CDate(b) And Sheet10.Cells(i, 1).Value <= CDate(c) Then
Me.LBOXSales.AddItem Sheet10.Cells(i, 2).Value
For d = 1 To 4
Me.LBOXSales.List(LBOXSales.ListCount - 1, d) = Sheet10.Cells(i, d + 1).Value
Next d
End If
Next i
End Sub
Thank you!