I have an excel file with formula in each cell , and i want avoid re writing all the data inside the excel because if we use write range on all of data range, then the formula will also be deleted.
so i only want to delete the rows which have condition where there are 3 particuluar column with value of 0
Condition : Note : on the process Im using excel application scope
column1= 0
column2=0
column3=0 Example
Change the sheetname in the code and excel path BlankProcess4.zip (618.4 KB)
sub deleteRowsWithZeros()
Dim ws As Worksheet
Dim lastRow As Long
Dim i As Long
Set ws = ThisWorkbook.Sheets("Sheet1") ' Change "Sheet1" to the name of your sheet
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
For i = lastRow To 2 Step -1
If ws.Cells(i, 1).Value = 0 And ws.Cells(i, 2).Value = 0 And ws.Cells(i, 3).Value = 0 Then
ws.Rows(i).Delete
End If
Next i
End sub