Filtering dates from database to other worksheets

I have a database currently with dates of the entries and would like to sort them into other worksheets based on their month (e.g into worksheets such as Jan, Feb , Mar) using vba. How would you filter for that specific month and copy the entire row of all entries that meet this criteria into an other worksheet? The code is not running at MonthNo = Month(time) currently. Also how would could you set the range to the usedrange of the column?

`Private Sub Move()

Dim time As Range Dim spread As Range Dim MonthNo As Integer

Set time = ThisWorkbook.Worksheets("MasterSheet").Range("A2:A9999")

For Each spread In time

MonthNo = Month(time)

If MonthNo = 1 Then EntireRow.Copy Destination:=Worksheets("Jan")

End If Next End Sub`



Read more here: https://stackoverflow.com/questions/68478284/filtering-dates-from-database-to-other-worksheets

Content Attribution

This content was originally published by Justrin at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: