bobunknown
Registered User.
- Local time
- Today, 07:55
- Joined
- May 25, 2018
- Messages
- 77
Airtight this is my best crack at it.
My thoughts on this is to remove the need for using the date to filter and use just the month. hence the change to IntMonth. Ill explain why.
(the rest of the code may be garbage but its what looked somewhat right to me though I know there is an issue with the line starting lngDataLen, looking in to that now :banghead
The data i'm looking at relates to parking permits. There are fields such as:
Date Issued, Name, address, Registration and Expiry Date (contained in column M:M).
All I am doing is filtering the data in to months (that they expire) and placing that information in the corresponding, named, sheet.
The sheet I have in front of me has 13 tabs, one with the main load of data labelled "LongStayPermits" and the rest are labelled as their corresponding month Starting from the end of March (Financial Year).
Hopefully this explains it a little better.
Code:
Private Sub Workbook_Open()
Dim intMonth As Integer, intDay As Integer, intYear As Integer
Dim strDate As String
intMonth = Month(3)
Sheets("LongStayPermit").Select
Columns("M:M").Select
ActiveSheet.Range("$M$1:$M$244").AutoFilter Field:=1, Criteria1:= _
lngDataLen = Range("M" & Rows.Count).End(xlUp).Row
Cells.Select
For intMonth = 1 To 12
strDate = Format(DateSerial(intYear, intMonth + 1, 0), "dd/mm/yyyy")
Debug.Print strDate
If lngDataLen > 1 Then
Selection.Copy
Sheets(MonthName(intMonth)).Range("A1").PasteSpecial
End If
Next
Sheets("LongStayPermits").Select
ActiveSheet.Range("$M$1:$M$244").AutoFilter Field:=1
End Sub
(the rest of the code may be garbage but its what looked somewhat right to me though I know there is an issue with the line starting lngDataLen, looking in to that now :banghead

The data i'm looking at relates to parking permits. There are fields such as:
Date Issued, Name, address, Registration and Expiry Date (contained in column M:M).
All I am doing is filtering the data in to months (that they expire) and placing that information in the corresponding, named, sheet.
The sheet I have in front of me has 13 tabs, one with the main load of data labelled "LongStayPermits" and the rest are labelled as their corresponding month Starting from the end of March (Financial Year).
Hopefully this explains it a little better.