December 4, 2018
Hi,
Please assist with a macro that can help with deleting entire rows for cells with a value amount of exactly 0 in column "A"
Rgds.
VIP
Trusted Members
June 25, 2016
Hi Themba
Try this
Sub DelRows()
Dim LastRow As Long
Dim i As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = LastRow To 1 Step -1
If Cells(i, 1) = 0 Then
Rows(i).Delete Shift:=xlUp
End If
Next
Application.ScreenUpdating = True
End Sub
Sunny
Answers Post
VIP
Trusted Members
June 25, 2016
Are you referring to column A with multiple criteria or multiple column with criteria?
Either way you can use OR to check multiple criteria.
Example:
If Cells(i,1)="X" or Cells(i,2)="Y" OR Cells(i,3)="Z" Then
to delete the row if the any of the cells contains X, Y or Z etc
If all the criteria is in a single column, then you should match cell by cell against a list of criteria instead of using multiple ORs
You can post your file with enough examples for us to understand better what you wanted.
December 5, 2016
Sub DelRows()
Dim LastRow As Long
Dim i As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = LastRow To 1 Step -1
If Cells(i, 1) = any text { ie string value] or Cels(i,1) = blank row or Then
Rows(i).Delete Shift:=xlUp
End If
Next
Application.ScreenUpdating = True
End Sub
How to re-write the macro if Column A data contact any string value or blank row, then delete , leaving only date value in the column A data
VIP
Trusted Members
June 25, 2016
1 Guest(s)