filmov
tv
How to Delete rows in Excel VBA using For loop

Показать описание
Title:How to Delete rows in Excel VBA using For loop
Recommended Excel VBA books
===================================================
====================================================
In this video you'll learn how to delete rows using VBA when specific conditions exist and a logic behind it. If you delete the rows from top to bottom then excel will skip the row which presents below the current row so VBA command won't work properly in this case. So you need to go from bottom to top-down approach when you are using For loop. Watch this video to learn more .
Code:
Sub deleterows()
Dim lastrow
'Finding the lastrow in Column A
lastrow = ThisWorkbook.Sheets(1).Range("A65356").End(xlUp).Row
'Deleting the cell contain 1 in Column A
For i = lastrow To 2 Step -1
'Finding the cell which contain 1 in Column A
If ThisWorkbook.Sheets(1).Cells(i, 1) = "1" Then
ThisWorkbook.Sheets(1).Rows(i).EntireRow.Delete
End If
Next i
End Sub
Recommended Excel VBA books
===================================================
====================================================
In this video you'll learn how to delete rows using VBA when specific conditions exist and a logic behind it. If you delete the rows from top to bottom then excel will skip the row which presents below the current row so VBA command won't work properly in this case. So you need to go from bottom to top-down approach when you are using For loop. Watch this video to learn more .
Code:
Sub deleterows()
Dim lastrow
'Finding the lastrow in Column A
lastrow = ThisWorkbook.Sheets(1).Range("A65356").End(xlUp).Row
'Deleting the cell contain 1 in Column A
For i = lastrow To 2 Step -1
'Finding the cell which contain 1 in Column A
If ThisWorkbook.Sheets(1).Cells(i, 1) = "1" Then
ThisWorkbook.Sheets(1).Rows(i).EntireRow.Delete
End If
Next i
End Sub
How to Delete Blank Rows in Excel
How to Delete Row in Excel
HOW TO DELETE BLANK ROWS WITHOUT LOSING DATA [THE RIGHT WAY]
Delete Empty Rows with these Excel Shortcuts #shorts
How to insert or delete rows and columns in Microsoft Excel
How to delete multiple rows & columns with shortcuts in MS Excel?
Delete rows with empty cells in #Excel
Delete Empty Rows at the bottom of your Google Sheet, the easy way
#exceltricks How to delete blank rows #advanceexcel
How to Delete Blank Rows in Excel for Mac
Delete All Blank Rows in Excel Entire Row @BrainUpp
How to delete alternate rows in Excel
How to Delete Blank Rows in Excel ? | Excel Tips & Tricks #shorts
How to Delete multiple Rows In Excel | same time
How to delete filtered rows in Excel
How to Quickly Insert and Delete Rows in a Table - MS Word
How to delete rows in excel that go on forever
How To Delete Blank Rows In Google Sheets #shorts
Shortcut Key to Delete Rows in Excel (Excel Shortcuts)
How to Delete Multiple Blank Rows in Excel in Under 1 Minute
MS Excel: Deleting complete blank rows without deleting blank cells in the filled row
How to Delete Blank Rows in Excel
VBA Macro to Delete Rows Based on Cell Values
How to DELETE MULTIPLE ROWS All at Once in EXCEL
Комментарии