Excel VBA delete row if contains certain strings (edit)
https://excel.officetuts.net/en/vba/delete-a-row-if-cell-contains
https://analysistabs.com/vba/delete-row-if-cell-contains-string-excel-macro-example-code/
What is VBA?
The acronym VBA stands for Visual Basic for Applications. It is an integration of the Visual Basic with Microsoft Office applications (MS Excel, MS PowerPoint, MS Access, MS Word and MS Outlook). By running VBA within the Microsoft Office applications, you can automate repetitive tasks.
Getting Started With VBA
https://www.guru99.com/creating-your-first-visual-basic-for-applications-vba-in-excel.html
https://riptutorial.com/excel-vba
https://www.listendata.com/2014/05/excel-macro-beginner-tutorial-make-your.html
https://www.i-programmer.info/ebooks/automating-excel/1264-getting-started.html
Getting Started With VBA Automation
https://spreadsheet1.com/getting-started-with-vba.html
Open The Visual Basic Editor
https://www.thespreadsheetguru.com/
http://excelexperts.com/Free-Excel-Training-Videos
What are excel macros?
https://www.listendata.com/2014/05/excel-macro-beginner-tutorial-make-your.html
5 Different Ways to Find The Last Row or Last Column Using VBA
Copy & Paste Multiple Excel Ranges To Separate PowerPoint Slides With VBA
Code Sample
Giả sử cột A có những Row chứa chuỗi cần Delete cả dòng đó, ta thực hiện như sau:
- Press Alt + F11
- Go to menu Insert > Module
- Paste the following code
- F5 to delete entire row
Sub DeleteEntireRow()
Dim i As Long, searchString As String
For i = Range("A" & Rows.Count).End(xlUp).Row To 1 Step -1
searchString = LCase(Range("A" & i))
If (InStr(1, searchString, ".exe") > 0) Or _
(InStr(1, searchString, ".png") > 0) Or _
(InStr(1, searchString, ".jpg") > 0) Then
Rows(i).Delete
End If
NextRow:
Next i
End Sub