Hi All,
I have the following code that checks each cell in range for a certain condition. If it meets the criteria then the entire row is deleted. The problem I'm having is that once a row is deleted the "Next Cell" potion of the code jumps down a row rather than dealing with the next cell in the range. Is there a quick fix to amend this issue?
[vba]Sub remove_WE_Dates_Outside_Period()
Dim Range1 As Range
Set Range1 = Range(ActiveCell, ActiveCell.End(xlDown))
For Each cell In Range1
If DateValue(cell) < DateSerial(Year(Date), Month(Date) - 1, 1) Then
cell.EntireRow.Delete
Else
If DateValue(cell) < DateSerial(Year(Date), Month(Date) - 1, 1) Then
cell.EntireRow.Delete
Else
If DateValue(cell) >= DateSerial(Year(Date), Month(Date), 1) Then
cell.EntireRow.Delete
Else
If Weekday(cell, vbMonday) = 6 Or Weekday(cell, vbMonday) = 7 Then
cell.EntireRow.Delete
Else
End If
End If
End If
End If
Next cell[/vba]
thanks in advance.
Paddy.