Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have an Excel sheet on which:
1. columns B and D contain the same dates down each column. 2. From column E and up contain data ** I am looking for a macro that will loop through columns B and D. If it finds any row on which the dates in B and D do not fall within the last month's dates then - it should clear those dates in B and D, and also - clear all data on that row starting from Column E and up. - Where B and D do not contain any dates it should do nothing. I would appreciate your assistance very much. Thanks. Jay Dean |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ClearOldDates()
Dim oCell As Range For Each oCell In Range("B:B") If IsDate(oCell) Then If Not (Year(oCell) = Year(Now()) And Month(oCell) = Month(Now())) Then oCell.EntireRow.Range("D1:IV1").ClearContents oCell.ClearContents End If End If Next oCell End Sub Jay Dean wrote I have an Excel sheet on which: 1. columns B and D contain the same dates down each column. 2. From column E and up contain data ** I am looking for a macro that will loop through columns B and D. If it finds any row on which the dates in B and D do not fall within the last month's dates then - it should clear those dates in B and D, and also - clear all data on that row starting from Column E and up. - Where B and D do not contain any dates it should do nothing. I would appreciate your assistance very much. Thanks. Jay Dean |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to clear contents of certain cells | Excel Discussion (Misc queries) | |||
Macro to clear contents and put an X | Excel Discussion (Misc queries) | |||
Macro to clear contents of unprotected cells AND drop down boxes | Excel Discussion (Misc queries) | |||
HOW DO I PROTECT VALUES WHEN CREATING CLEAR CONTENTS MACRO? | Excel Discussion (Misc queries) | |||
Clear Contents Macro | Excel Worksheet Functions |