Hi Paul, Thanks for giving me the clue by "DateDiff". Till ur reply i dont know "DateDiff" method since im a leaner it helped to find the solution below is my solution for my requirement.
Dim b As Variant Dim d1 As Date Dim d2 As Long d1 = "01-jan-2007" L1: b = ActiveCell.Value d2 = DateDiff("d", d1, b) If d2 < 0 Then ActiveCell.EntireRow.Delete If ActiveCell.Value <> "" Then GoTo L1 Else GoTo L2 End If Else ActiveCell.Offset(1, 0).Select GoTo L1 End If L2: Thanks, Sundarvelan On Wed, Apr 21, 2010 at 5:26 PM, Paul Schreiner <schreiner_p...@att.net>wrote: > "Please provide VBA Code"... > > for WHAT exactly? > In your question: > "deleted the complete rows": use: Rows("4:4").EntireRow.Delete > or Range("A4").EntireRow.Delete > or cells(4,1).EntireRow.Delete > > "if the cell contains dates before 1/1/2007" > what cell? > any cell in the row? > the cell in column "a" ? > you could use: > If (DateDiff("d", Cells(4, 1).Value, "1/1/2007") > 0) Then > > Or are you asking us to write the entire VBA macro? like: > > Sub DeleteRows() > Dim nRows, R > nRows = ActiveCell.SpecialCells(xlLastCell).Row > For R = nRows To 1 Step -1 > If (Cells(R, 1).Value <> "") Then > If (DateDiff("d", Cells(R, 1).Value, "1/1/2007") > 0) Then > Cells(R, 1).EntireRow.Delete > End If > End If > Next R > End Sub > > Of course, this assumes that the date is in column 1 (A)... > since I have nothing to tell me otherwise. > > Or.. are you asking us to tell you how to create VBA code? > > your question is too vague.... it means that we have to spend WAY too > much time simply trying to figure out what your question is... > and, like in this case, we have to either provide several answers > in the hope that one fits, or simply ignore the question and let > someone else deal with it... > > If you wish for US to spend OUR time in providing YOU with free help, > the least you could do is invest a little of YOUR time in describing > what it is that you need, and what you've accomplished so far. > > Paul > > ------------------------------ > *From:* Sundarvelan N <nsund...@gmail.com> > *To:* excel-macros@googlegroups.com > *Sent:* Wed, April 21, 2010 4:27:44 AM > *Subject:* $$Excel-Macros$$ Excel-Macro-VBA Code > > Hi Group Friends, > > > Please help in this regard. I need to deleted the complete rows if the cell > contains dates before 1/1/2007. > > Please provide VBA Code > > Thanks > N.Sundarvelan > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > HELP US GROW !! > > We reach over 6,800 subscribers worldwide and receive many nice notes about > the learning and support from the group.Let friends and co-workers know they > can subscribe to group at > http://groups.google.com/group/excel-macros/subscribe > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > HELP US GROW !! > > We reach over 6,800 subscribers worldwide and receive many nice notes about > the learning and support from the group.Let friends and co-workers know they > can subscribe to group at > http://groups.google.com/group/excel-macros/subscribe > -- N.Sundarvelan -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,800 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe