View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AKphidelt AKphidelt is offline
external usenet poster
 
Posts: 461
Default Can't delete empty but active cells

Wait, are you saying you want only the 12,000 rows showing data to show and
delete the remaining rows? Or is there formulas or something that you are
trying to get rid of below the 12,000 rows?

Because I don't think it's possible to actually delete the blank rows. You
can hide them.

"Peter Chatterton" wrote:

I have a work sheet with 65,536 rows
only the first 12,000 of which have data,
but I can't figure out how to delete the empty but active rows.

I could do a reverse Find from the end and then delete the trailing Range,
but hoped there might be an easier way.

I thought the following, from Chapter 5 of Excel 2002 VBA Programmer's
Reference,
(http://www.wrox.com/WileyCDA/WroxTit...load_code.html)
might work (going by the title), but it doesn't.

Sub DeleteEmptyRows()
Dim rngRow As Range
For Each rngRow In ActiveSheet.UsedRange.Rows
If WorksheetFunction.CountA(rngRow) = 0 Then
rngRow.EntireRow.Delete
End If
Next rngRow
End Sub


Hope you can help,
Peter