Row deletion debug
Dim rngRange as Range
Dim dteDate as Date Set rngRange = ActiveSheet.UsedRange.Columns(3) For lngR = rngRange.Rows.Count To 1 Step -1 dteDate = Cells(lngR,"C").Value If Format(dteDate, "M") = 8 Then Rows(lngR).EntireRow.Delete End If Next lngR -- Regards, Tom Ogilvy "raj" wrote in message ... Hello, I hope someone can help me debug the following. It is supposed to delete rows when a date column is in August (8). The program runs without generating any errors, but it also fails to do anything: dteMonth = DateSerial(Year(Date), 8, Day(Date)) Set rngRange = ActiveSheet.UsedRange.Columns(3) For lngR = rngRange.Rows.Count To 1 Step -1 If rngRange.Rows(lngR).Offset(0, _ -2).FormulaR1C1 _ Like "###.###.####.######.###.##.###" Then _ dteDate = DateSerial(Year(rngRange.Rows (lngR).Value), Month(rngRange.Rows(lngR).Value), Day (rngRange.Rows(lngR).Value)) If Format(dteDate, "M") = Month(dteMonth) Then rngRange.Rows(lngR).EntireRow.Delete End If Next lngR Sorry its so choppy, I can't do much with this editor. Thanks in advance for your assistance. |
All times are GMT +1. The time now is 12:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com