Excel VBA Macro: Delete Rows if Cell Does Not Contain a Certain Text (String) Value

greggowaffles
greggowaffles
3.7 هزار بار بازدید - 2 سال پیش - Excel VBA Macro: Delete Rows
Excel VBA Macro: Delete Rows if Cell Does Not Contain a Certain Text (String) Value 💥Subscribe: Code: Sub delete_all_rows_without_string() Dim row_count As Long Dim i As Long Dim ws As Worksheet Dim my_string As String Set ws = ThisWorkbook.Sheets("Sheet1") ws.Activate row_count = ws.Cells(Rows.Count, "A").End(xlUp).Row i = 1 Do While i <= row_count my_string = ws.Cells(i, 1).Text If InStr(my_string, "hostname") = 0 _ And InStr(my_string, "transport output none") = 0 Then Rows(i).EntireRow.Delete i = i - 1 row_count = row_count - 1 End If i = i + 1 Loop End Sub #excelmacro #excelvba
2 سال پیش در تاریخ 1401/12/09 منتشر شده است.
3,765 بـار بازدید شده
... بیشتر