Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Option Explicit
Public Sub Tester2a() Dim WB As Workbook Dim SH As Worksheet Dim LastRow As Long Dim FirstRow As Long Dim iRow As Long 'set it up to point at the correct workbook/worksheet Set WB = ActiveWorkbook '<<==== CHANGE Set SH = WB.Sheets("Sheet1") '<<==== CHANGE With SH 'lastrow is the same as the row number for the cell you go 'to when you hit ctrl-end manually. LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row 'just a stopping point. 'if you had a bunch of headers (some empty rows), you 'could ignore them by changing this to a larger number FirstRow = 1 'start at the lastrow and go up the rows (step -1 is up) For iRow = LastRow To FirstRow Step -1 'if you see anything (formulas or values in that row) 'then =counta() will be 0 If Application.CountA(.Rows(iRow)) = 0 Then 'but if it no cells are filled in, then 'delete that row .Rows(iRow).Delete End If Next iRow End With End Sub juergenkemeter wrote: Hi! Dave, your first code sample does the necessary. Could you shortly explain how your code works? Thanks to you both for your help! Juergen -- juergenkemeter ------------------------------------------------------------------------ juergenkemeter's Profile: http://www.excelforum.com/member.php...o&userid=25248 View this thread: http://www.excelforum.com/showthread...hreadid=499951 -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to remove empty rows? | Excel Discussion (Misc queries) | |||
How do I remove empty Rows | Excel Discussion (Misc queries) | |||
Remove empty rows in excel? | Excel Discussion (Misc queries) | |||
remove all blank or empty rows | Excel Programming | |||
Remove empty rows | Excel Programming |