Рет қаралды 315
Excel VBA Macro: Delete Rows If Any Cell in Those Rows (Across All Columns) Contains a Certain Value
💥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