1

I have the following For Loop. It is supposed to delete lines with all the . 's.
It is deleting the lines, but when there are rows are like the picture, the code is skipping one of them and deleting one of them.

enter image description here

For row_num = 8 To max_row
page_title = Sheets("Stack").Range("C" & row_num + 1).value
        If page_title = " ....................................................................................................................................................................................................................................................................................................." Then
            Sheets("Stack").Range("C" & row_num + 1).EntireRow.delete
        End If
    Debug.Print page_title
Next row_num

Can anyone help with deleting sequential rows that contain .'s ?

braX
  • 11,506
  • 5
  • 20
  • 33
excelguy
  • 1,574
  • 6
  • 33
  • 67

1 Answers1

1

This is beacuse the logic of the routine. For example, if you delete row 5, now row 6 will be row 5 and so on, so row 6 will not be read. Insted of delete the row, try setting the values of the column as Empty

Sheets("Stack").Range("C" & row_num + 1).EntireRow = Empty

And you will see all lines will be read.

After you finish, you can tell excel/vba to roganize your matriz according to one column, so empty rows will be organized at the end, is that to say, will become part of the rest empty spacies of the sheet

Juan Joya
  • 120
  • 5