Viking1221
New Member
- Joined
- May 25, 2017
- Messages
- 32
Hello,
I have this macro that is supposed to delete rows that are blank in either column C or D, but it tends to run for a long time and I am not sure why. Any ideas on how to make it more efficient?
Sub deleteBlankRows()
Range("D10:D8000").Select
Selection.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Range("C10:C8000").Select
Selection.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
I also have a macro that delete row with all 0' in certain columns and it also seems to take a while to run. Not sure where I am going wrong:
Public Sub DeleteZeroRows()
Dim i As Long, lastrow As Long
lastrow = Range("D" & Rows.Count).End(xlUp).Row
For i = lastrow To 1 Step -1
If Application.Sum(Range("D" & i & ":BZ" & i)) = 0 Then
Rows(i).Delete
End If
Next i
End Sub
Thanks
I have this macro that is supposed to delete rows that are blank in either column C or D, but it tends to run for a long time and I am not sure why. Any ideas on how to make it more efficient?
Sub deleteBlankRows()
Range("D10:D8000").Select
Selection.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Range("C10:C8000").Select
Selection.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
I also have a macro that delete row with all 0' in certain columns and it also seems to take a while to run. Not sure where I am going wrong:
Public Sub DeleteZeroRows()
Dim i As Long, lastrow As Long
lastrow = Range("D" & Rows.Count).End(xlUp).Row
For i = lastrow To 1 Step -1
If Application.Sum(Range("D" & i & ":BZ" & i)) = 0 Then
Rows(i).Delete
End If
Next i
End Sub
Thanks
Last edited: