Excel VBA Macro: Delete Rows If Any Cell Contains a Specific Value (Across All Columns)
💥Subscribe: / @greggowaffles
Code:
Sub delete_rows_across_all_cols()
Dim row_count As Long
Dim col_count As Long
Dim i As Long
Dim j As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("NYSE Stocks")
ws.Activate
row_count = ws.Cells(Rows.Count, 1).End(xlUp).Row
col_count = ws.Cells(1, Columns.Count).End(xlToLeft).Column
i = 2
Do While i <= row_count
For j = 1 To col_count
If Cells(i, j) = "" Then
Rows(i).EntireRow.Delete
i = i - 1
row_count = row_count - 1
End If
Next j
i = i + 1
Loop
End Sub
#excelmacro #excelvba #excelvbatutorial
Watch video Delete Rows If Any Cell Contains a Specific Value (Across All Columns) | Excel VBA Macro online without registration, duration hours minute second in high quality. This video was added by user greggowaffles 08 March 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 36 once and liked it 1 people.