To do it yourself, start by searching on terms like VBA move data to worksheets based on date. Those search results will give you a starting point. Then when you need help debugging the details, post here for help.
Creating a Macro that sorts data into seperate sheets.
So I'd like to have a macro that shows up as a button. The idea is when I press this button, it takes the data I have and sorts it into different sheets based on a date column. The different sheets would be Past due (So date is before today, Less than 1 month (30 days), and more than 30 days. Is this possible and how would I go about this.
2 answers
Sort by: Most helpful
-
-
Victor Lopez 41 Reputation points
2022-06-15T16:31:07.323+00:00 Attached are 2 images of my current sheets. The goal is to have it sort into separate sheets the data based on how far away the due date is vs todays date, the following code I use was able to do that but for the Students grades, but anytime I try to do it for the date it doesn't recognize the numbers besides -1. I used a cell formula to give me a value for how many months away the date is vs todays date.
Sub SplitandFilterSheet()
Dim Splitcode As Range
Sheets("Master").Select
Set Splitcode = Range("Splitcode")For Each cell In Splitcode
Sheets("Master").Copy After:=Worksheets(Sheets.Count)
ActiveSheet.Name = cell.ValueWith ActiveWorkbook.Sheets(cell.Value).Range("MasterData")
.AutoFilter Field:=5, Criteria1:="<>" & cell.Value, Operator:=xlFilterValues
.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
End WithActiveSheet.AutoFilter.ShowAllData
Next cell
End Sub