Looks broken to me...
If you want the code to delete dates in the Selection which are outside the
date window specified, then change the following:
from: If c < x And c y Then
to: If c < x Or c y Then
If you want the code to delete dates in the Selection which are inside the
date window specified, then change the following:
from: If c < x And c y Then
to: If c = x And c <= y Then
Just beware of the < <= = because they can cause pain with dates
(especially date windows) if you don't get the rules for them correct up
front - they can be very different depending on purpose.
--
Rob van Gelder -
http://www.vangelder.co.nz/excel
"ExcelBeginner" wrote in message
...
I tried this macro and it doesn't seem to do anything .. .I found it
below.
I was hoping it would delete row with certain dates in a spreadsheet. Is
there something missing in the code?
Sub test1()
Dim c As Excel.Range
x = InputBox("start date?")
y = InputBox("stop date?")
For Each c In Selection
If c < x And c y Then
cell.EntireRow.delete
End If
Next
End Sub