View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default deleting empty rows within a range

After your sort, add code like:

Dim myRow As Integer
myRow = Range("I6").End(xlDown).Row
If myRow < 233 Then
Range(Range("I" & myRow + 1), Range("I233")).Resize(, 5).Delete Shift:=xlUp
End If

HTH,
Bernie
MS Excel MVP


"HGood" wrote in message
...
Hi, I've been studying the various posts related to this, but can't find any
that are close enough to this, to allow my very limited VBA skills to adapt
them. Thanks for any help you can offer.

I have a range I6:M233. I've constructed code to sort this by doing a macro,
so after sorting, all the data is at the top. Now I'd like help to add to
that sorting code so as to delete all the non data cells (though the empty
ones still contain formulas) below this data. Column I is the date, and if it
is empty, all 5 cells in that row can be deleted. But the entire row should
not be deleted because there is critical data to the left of column I.

Also, M234 is a total, so after the deletion code is finished, I'd like to
have this Total moved up to be under the bottom most row with data.

Thanks for any help you can give as to what the code should look like. I
know it needs to have Count in it but I don't know how to build code around
it.

Many thanks, Harold