![]() |
Empty/Delete Cells in a Column
Hello,
I've got three columns, A, B and C. Every cell in A is populated with a date with the same month and year i.e. XX/08/2007 (dd/mm/yyyy). B and C also have dates (not necessarily in every cell). What I would like to do is empty cells in B and C that are not XX/08/2007 whether in the past or future. Any help would be appreciated. |
Empty/Delete Cells in a Column
Sub removedates() RowAMonth = Month(Range("A1")) RowAYear = Year(Range("A1")) Set BCRange = Range("B2:C20") For Each cell In BCRange If IsDate(cell) Then If (Month(cell) < RowAMonth) Or _ (Year(cell) < RowAYear) Then cell.ClearContents End If End If Next cell End Sub "SSwan" wrote: Hello, I've got three columns, A, B and C. Every cell in A is populated with a date with the same month and year i.e. XX/08/2007 (dd/mm/yyyy). B and C also have dates (not necessarily in every cell). What I would like to do is empty cells in B and C that are not XX/08/2007 whether in the past or future. Any help would be appreciated. |
Empty/Delete Cells in a Column
Thank you Joel.
"Joel" wrote: Sub removedates() RowAMonth = Month(Range("A1")) RowAYear = Year(Range("A1")) Set BCRange = Range("B2:C20") For Each cell In BCRange If IsDate(cell) Then If (Month(cell) < RowAMonth) Or _ (Year(cell) < RowAYear) Then cell.ClearContents End If End If Next cell End Sub "SSwan" wrote: Hello, I've got three columns, A, B and C. Every cell in A is populated with a date with the same month and year i.e. XX/08/2007 (dd/mm/yyyy). B and C also have dates (not necessarily in every cell). What I would like to do is empty cells in B and C that are not XX/08/2007 whether in the past or future. Any help would be appreciated. |
All times are GMT +1. The time now is 07:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com