Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a 1-column spreadsheet that contains data in column H (with a heading
in cell H1). Some rows in column H contain no data or a single space. Starting with cell H2, I needed a macro that would examine each cell in column H and automatically delete a row where no data or only 1 space exists. The macro would terminate after reaching row 1,000. Someone else in this forum proposed the following macro: Set currentCell = Worksheets("Sheet1").Range("H2") for each cell in range("H2:H1000") Set nextCell = currentCell.Offset(1, 0) If Len(currentCell.Value) <= 1 Then currentCell.EntireRow.Delete End If Set currentCell = nextCell Next Unfortunately, when I run the macro the first time, SOME rows with cells whose LEN<=1 still remains! When I run the macro a second time, it then catches and removes those remaining rows. Does anyone have any idea why I need to run the aforementioned macro twice for it to truly complete the job? I would greatly appreciate any help. Thanks. Bob |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Removing Blank Rows ? | New Users to Excel | |||
Removing blank rows | Excel Programming | |||
Removing blank rows in a worksheet | Excel Worksheet Functions | |||
Copying and pasting a worksheet to a blank and removing blank rows | Excel Programming | |||
Removing Blank Rows? | Excel Programming |