View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Maury Markowitz[_2_] Maury Markowitz[_2_] is offline
external usenet poster
 
Posts: 119
Default Deleting entire row

On Dec 8, 3:49*pm, daisy2008
wrote:
I need an entire row deleted if column 2 on worksheet 3; date is one year
later but is less then todays date. *I need this to run when my workbook is
opened.

Ex
B4 January 2, 2008
B5 November 4, 2007
B6 December 26, 2007
B7 December 5, 2007

Row 5 *and row 7 are deleted when I open the workbook.


Well the opening the notebook is up to you. However, the code will be
similar to...

for i = 1 to ASMANYROWSASYOUCAREABOUT
theCell = Cells(2,i)
if abs(datediff("yyyy", theCell, date)) 1 then
theCell.entirerow.delete
end if
next i

Maury