espenskeie
Well-known Member
- Joined
- Mar 30, 2009
- Messages
- 636
- Office Version
- 2016
- Platform
- Windows
Hello
I have a range where some of the rows are blank, and sometimes there are two or more in a row without data.
The code that I have remove one blank cell range, but it also skip the next row because the loop doesn't "know" that one row has been removed.
I also have to add that I don't want the entire row to be deleted, only the range .
Regards
Espen
I have a range where some of the rows are blank, and sometimes there are two or more in a row without data.
The code that I have remove one blank cell range, but it also skip the next row because the loop doesn't "know" that one row has been removed.
I also have to add that I don't want the entire row to be deleted, only the range .
Code:
Sub Delete_Row()
Dim temp As Long, x As Long
temp = Sheets("1HourDATA").Range("C65536").End(xlUp).Row
For x = 2 To temp
Cells(x, 3).Select
If Cells(x, 3) = "" Or Cells(x, 3) = 0 Then
Range("C" & x & ":L" & x).Select
Selection.Delete Shift:=xlUp
End If
Next x
End Sub
Regards
Espen