Eric Penfold
Active Member
- Joined
- Nov 19, 2021
- Messages
- 431
- Office Version
- 365
- Platform
- Windows
- Mobile
This code needs to delete any table rows which are next month. The Dims etc. are correct so i can`t workout why it`s not depleting the next month lines ??
VBA Code:
With tblDailyMail.DataBodyRange
For Rw = .Rows.Count To 1 Step -1
For Each Cell In .Range("A2:A" & LRow)
intDaysInMonth = Day(DateSerial(Year(Now()), Month(Now()) + 1, 0))
For x = 1 To intDaysInMonth
If Not Cell = DateSerial(Year(Now()), Month(Now()), x) Then
.ListRows(Rw).Delete
End If
Next x
Next Cell
Next Rw
End With