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.
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
How to modified teh VBA if this cell range contains multiple criteria , say " ABC co" , "Dept", "Allocation Code" , "Currency","Country"
and to be deleted by macro
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.
Tks Sunny , it work perfectly!
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
Try
If Not IsDate(Cells(i,1)) Then
Tks will try
I tried and confirm the Syntex work. Thanks again Sunny..
If Not IsDate(Cells(i,1)) Then
OK No problem.