Excel VBA to Delete Rows if Cell is Blank - Delete Rows Based on Cell Value - Code Included
This Excel VBA Tutorial explains VBA Code to delete rows when cell is blank. You can use For Loop with If Condition to write VBA code to delete rows based on cell value condition.
VBA Code , used in this example is as follows :
a = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If Worksheets("Sheet1").Cells(i, 3).Value = "" Then
Rows(i).Delete
End If
Next
Пікірлер: 29
THANKS A LOT..THIS VIDEO HELPED ME A LOT...!!!
Good example. Thank you for all your effort.
@ExcelDestination
3 жыл бұрын
Glad it was helpful!
Thank you so Mitch, Sur.
@ExcelDestination
3 жыл бұрын
Welcome!
Thank you 💗💛
Thanks!
Thank you
Sir it's really helpful I searched have many videos still little bit helps I will try if not I will ask you.
Thank you very much. What I think would be very helpful is if the deleted row and cell value were copied to another worksheet. This way someone can use the worksheet with the rows containing the missing data to find the missing data.
@ExcelDestination
3 жыл бұрын
yes, that's a good thought.
@tannertucker22
3 жыл бұрын
@@ExcelDestination i am an auditor. Auditor always want to know what is missing.
@tannertucker22
3 жыл бұрын
Even better. Shade blank cells yellow or any color within the current region. Then delete any row with a blank cell. The paste to new worksheet. No you have a worksheet that a user can find the missing data with the cells (Formatted) shaded that require data.
Hi Sir, this is a good video! Sir how about if you want to delete multiple values in a column like blanks, delhi and pune? Thanks and more video to teach and inspire others.
Good
Thank you for the video can you please to show how to delete the entire empty row based on the entire empty cells row (not based on the first empty cell) because there some data gets lost
One row selected not blanked cell that one row delete, pls help me sir... This for my own created sales sheet row line k13 to p13 after row using to this
sir how to copy non blank rows in new sheet for multiple column in data set
is it possible to delete just one cell 9not entire row )based on cell value
Can you delete any row where the sum of any row equal zero?
@ExcelDestination
3 жыл бұрын
yes, we can do that. some additional code is required to check sum before deleting row.
The problem in this approach is when there multiple empty values it should delete one and move to next
Need code to delete only if the whole row is empty not cell
Not working for me
Here, how we can delete non blank rows..
IT IS NOT WORKING IF THERE IS CONTINUES BLANKS REPEATS
too complicated tho
NOT WORKING
it is very useful however, I have a table copying from 1 book to another book and finally I want to delete empty rows from the 2nd table. I tried your method but not working for me. Private Sub CommandButton1_Click() a = Worksheets("hedef.xlsm").Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To a If Worksheets("hedef.xlsm").Cells(i, 3).Value = "" Then Rows(i).Delete End If Next End Sub can you please advise?