deleting rows in excel

  • Thread starter Thread starter nick80
  • Start date Start date
N

nick80

I have an excel sheet that looks like this:

jan 45.300
feb 56.987
mar 65.743

jan 43.256
feb 41.678


jan 78.934
feb 67.214
mar 56.983

etc...

So it's usuallly a set of data then an empty row and then again a se
of data. Problem is that I sometimes have 2 empty rows. How can
delete this "extra" row
 
try this where 20 is the last row

Sub deleteextrarow()
With Columns(1)
For r = 20 To 2 Step -1
With .Cells(r, 1)
If .Offset(0) = "" And .Offset(1) = "" _
Then .EntireRow.Delete
End With
Next
End With
End Sub
 
Use an empty column to the right of your data, say, column
C
Assuming your data starts in row 1 column a, in the first
cell type: =IF(AND(A1="","A2"=""),"Delete Me","") copy
this formula in each cell down to the end of the data.
Next apply the AutoFilter (Data/Filter/AutoFilter) and
filter column C to show "Delete Me" items. Right click on
the first row header of the filtered list and then press
Shift + End + down arrow to select the entire list. Right
click/delete row
 
Back
Top