ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I delete a row from a spreadsheet if criteria is not met i. (https://www.excelbanter.com/excel-worksheet-functions/23656-how-do-i-delete-row-spreadsheet-if-criteria-not-met-i.html)

wonderboy55

How do I delete a row from a spreadsheet if criteria is not met i.
 
In a spreadsheet, a column has 30 minutes or 60 minutes. Is there a way to
delete the entire row if the minutes < 30?


Bob Phillips

Need VBA for that


Dim iLastRow As Long
Dim i As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = iLastRow To 1 Step -1
If Cells(i, "A").Text = "00:30" Or Cells(i, "A").Text = "01:00" Then
Rows(i).Delete
End If
Next i

--
HTH

Bob Phillips

"wonderboy55" wrote in message
...
In a spreadsheet, a column has 30 minutes or 60 minutes. Is there a way to
delete the entire row if the minutes < 30?





All times are GMT +1. The time now is 12:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com