filmov
tv
Excel VBA Macro: Delete Rows if Cell Does Not Contain a Certain Text (String) Value
Показать описание
Excel VBA Macro: Delete Rows if Cell Does Not Contain a Certain Text (String) Value
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
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
VBA Macro to Delete Rows Based on Cell Values
Delete Rows Based On Criteria Excel VBA Macro
Excel VBA Macro: Delete Rows Based on Cell Value (Zeros and Blanks)
Excel VBA Macro: Delete Rows (Based on Cell Values in Multiple Columns)
Excel VBA Macro: Delete Rows (Based on List of Values)
Add Buttons To Delete Rows Excel VBA Macro
Excel VBA Macro: Delete Rows Faster (Based on Cell Value)
Excel VBA Delete row macro
Delete Blank Rows Excel VBA Macro
Excel VBA Macro: Delete Rows if Cell Does Not Contain a Certain Text (String) Value
Excel VBA - Rows and Columns Delete
Excel VBA to Delete Row or Column in Excel Table
VBA Macro Code to Delete Rows Based on Cell Values
How to use VBA in Excel to Delete Rows with Some Value
How to Delete rows in Excel VBA using For loop
Excel VBA macro to delete rows based on cells value
Delete Rows And Columns - VBA Macros - Tutorial - MS Excel 2007, 2010, 2013
Excel VBA - Delete Cells
Delete Rows based on Value/Text // Excel VBA Tutorial
31 VBA Macro to Insert/ Delete Rows or Columns
Excel VBA to Delete Rows if Cell is Blank - Delete Rows Based on Cell Value - Code Included
Deleting rows based on cell values across sheets using VBA
Row insert & delete | VBA tutorial | simple vba code in excel
Excel VBA - Clear Cells
Комментарии