Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting dates


I'm hoping this is simple one for one of you guru's. I'm looking for a
macro that will search multiple columns and clear any cell that has
today's date or older in it. Format of the date is 02-1-06 and
02-31-06. In other words, the day is not always two digits.


--
ebraun01
------------------------------------------------------------------------
ebraun01's Profile: http://www.excelforum.com/member.php...o&userid=30340
View this thread: http://www.excelforum.com/showthread...hreadid=513863

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting dates


Hello Ebraun01,

Try this macro...

Sub ClearDates()

Dim Cell As Range

For Each Cell In ActiveSheet.UsedRange
If VarType(Cell) = vbDate Then
If Cell.Value <= Int(Now) Then Cell.ClearContents
End If
Next Cell

End Sub

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=513863

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting dates


If I have a cell that only has a date, then it works but if the cell as
additional text in it, it doesnt. The macro needs to search all cells
and remove any that have dates older than today. An example of a date
is below. In this example I would want it to clear the cell with the
Lysol Spray. Hope that is more clear and thanks for the help.

Nabisco Crackers (2-26-06)
Lysol Disinfectant Spray (2-1-06)
Glade Spray (4-15-06)


--
ebraun01
------------------------------------------------------------------------
ebraun01's Profile: http://www.excelforum.com/member.php...o&userid=30340
View this thread: http://www.excelforum.com/showthread...hreadid=513863

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting dates


Hello Ebraun01,

Will the dates always be in parathesis? Will the day, month, and year
always be separated by hyphens?. As long as some aspects of the format
are constant, it won't be to difficult to adapt the code. Let me know.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=513863

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting dates


Yes, thanks for the clarification. The dates are all in parenthesis and
hyphens.


--
ebraun01
------------------------------------------------------------------------
ebraun01's Profile: http://www.excelforum.com/member.php...o&userid=30340
View this thread: http://www.excelforum.com/showthread...hreadid=513863

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting cell data without deleting formula Tom Hall Excel Discussion (Misc queries) 4 October 29th 06 04:07 PM
Deleting data by sorting dates drc Excel Discussion (Misc queries) 1 October 2nd 06 06:33 PM
Deleting time part of a Date, subtracting dates Shirley Munro Excel Discussion (Misc queries) 3 June 21st 06 11:58 AM
Deleting dates and vlookup Boethius1 Excel Discussion (Misc queries) 1 February 23rd 06 09:03 PM
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content rmaloy Excel Programming 5 February 9th 04 01:59 AM


All times are GMT +1. The time now is 03:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"