View Single Post
  #7   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

Try something like this, not sure if it will read the cells correctly or
not... but try

Range("A1").End(xlDown).Offset(1,0).Activate
Range(ActiveCell,ActiveCell.End(xlDown)).EntireRow .Hide

Im not next to excel right now, so this is just off the top of my head.
Someone else probably has something better.

"Peter Chatterton" wrote:

Okay, so I just want to hide the rows;
but I want to do it in a macro using 2002 VBA.

Peter.

"FSt1" wrote in message
...
hi,
I may be misunderstanding but as i read your post, you want to delete the
empty rows below your data?!?!?
not possible.
excel is fixed at 255 columns wide and 65536 rows high. and that is etched
in stone by the excel gods at microsoft.
you can hide them so that you can't see them but they will always be
there.
Sorry.
to hide rows....
Select the first row below your data. shift+end+down. formatrowhide
to unhide rows.....
select the sheet. formatrowunhide
regards
FSt1

"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