ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple Clear Contents (https://www.excelbanter.com/excel-programming/321776-simple-clear-contents.html)

Steph[_3_]

Simple Clear Contents
 
This seems so simple, but I can't figure it out.

In a large spreadsheet, I would like to ClearContents of the entire row IF
the contents in column D of each respective row is greater than the date
1/1/2005.

So in row 1, if D1 is 1/1/2005, clear
In row 2, if D2 is 1/1/2005, clear......

Thanks!



Tom Ogilvy

Simple Clear Contents
 
Dim rng as Range, cell as Range
set rng = Range(Cells(1,4),Cells(rows.count,4).End(xlup))
for each cell in rng
if isdate(cell) then
if cdate(cell.value) DateSerial(2005,1,1) then
cell.EntireRow.ClearContents
end if
end if
Next

--
Regards,
Tom Ogilvy


"Steph" wrote in message
...
This seems so simple, but I can't figure it out.

In a large spreadsheet, I would like to ClearContents of the entire row IF
the contents in column D of each respective row is greater than the date
1/1/2005.

So in row 1, if D1 is 1/1/2005, clear
In row 2, if D2 is 1/1/2005, clear......

Thanks!






All times are GMT +1. The time now is 02:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com