Dim intCnt As Integer
intCnt = 2
Do Until Worksheets("sheet1").Cells(intCnt, 3) = 0
If Worksheets("sheet1").Cells(intCnt, 3) < Worksheets("sheet1").Range("RemovalDate") Then
Worksheets("sheet1").Cells(intCnt, 3).EntireRow.Delete
Else
intCnt = intCnt + 1
End If
Loop
The date for removal should be placed in a cell named "RemovalDate".
cpod, I put that code in and nothing happened. It didn't change anything. Can anyone think of a different way to do this?
Brad
You do have to activate the macro. what module did you put it in.
cpod,
This is exactly how it looks in module 1 on sheet1 of Book3.
Sub dated()
Dim intCnt As Integer
intCnt = 2
Do Until Worksheets("sheet1").Cells(intCnt, 3) = 0
If Worksheets("sheet1").Cells(intCnt, 3) < Worksheets("sheet1").Range("RemovalDate") Then
Worksheets("sheet1").Cells(intCnt, 3).EntireRow.Delete
Else
intCnt = intCnt + 1
End If
Loop
End Sub
and yes I did execute the macro.
Brad
Is it in the Module 1 code window or in the Sheet1 code window?
Have you created the name "RemovalDate"?
An alternative way to do what you want is to sort your data by column C and then select and delete the rows with dates greater than the relevant date.
Celia