The condition is that in Column A, if the cell (A1,A2,A3....) is a merged cell, then delete the entire row and the row above this cell
I know how to delete one entire row but I duplicate the language when trying to delete the 2nd row (can I put them together?)
Sub test()
Dim i As Integer
For i = 1 To 300 Step 1
If Cells(i, 1).MergeCells = True Then Rows(i - 1).EntireRow.Delete 'delete the row above the merged cell
End If
Next i
For i = 1 To 300 Step 1
If Cells(i, 1).MergeCells = True Then Rows(i).EntireRow.Delete 'delete another row where the merged cell is
End If
Next i
End Sub
I know how to delete one entire row but I duplicate the language when trying to delete the 2nd row (can I put them together?)
Sub test()
Dim i As Integer
For i = 1 To 300 Step 1
If Cells(i, 1).MergeCells = True Then Rows(i - 1).EntireRow.Delete 'delete the row above the merged cell
End If
Next i
For i = 1 To 300 Step 1
If Cells(i, 1).MergeCells = True Then Rows(i).EntireRow.Delete 'delete another row where the merged cell is
End If
Next i
End Sub