Prev: cancel a combobox change
Next: Check user credentials
From: Kash on 7 Apr 2010 14:34 Hello there.. I was trying to cut the entire row and paste it to another sheet if date is more than 20 days say date column is 'H' Someone please help me on this.. Thank you..
From: Mike H on 7 Apr 2010 14:37 If date is more than 20 days what. In the past? In the future? something else? -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Kash" wrote: > Hello there.. I was trying to cut the entire row and paste it to another > sheet if date is more than 20 days > > say date column is 'H' > > Someone please help me on this.. > > Thank you..
From: Kash on 7 Apr 2010 14:41 I'm sorry.. if date is 20 days behind..
From: Mike H on 7 Apr 2010 14:52 Hi, try this Sub stance() Dim MyRange Dim CopyRange As Range Set sht = Sheets("Sheet1") lastrow = sht.Cells(Cells.Rows.Count, "H").End(xlUp).Row Set MyRange = sht.Range("H1:H" & lastrow) For Each c In MyRange If c.Value < Date - 20 Then If CopyRange Is Nothing Then Set CopyRange = c.EntireRow Else Set CopyRange = Union(CopyRange, c.EntireRow) End If End If Next If Not CopyRange Is Nothing Then CopyRange.Copy Destination:=Sheets("Sheet2").Range("A1") End If End Sub -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Kash" wrote: > I'm sorry.. if date is 20 days behind..
From: Kash on 7 Apr 2010 15:09
This works great.. Thank you Mike |