Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm using Excel XP. I can't seem to get the following
code to work. The following code deletes any blank row, and then moves to the next row and checks if it's blank, too. If it is, the row is deleted. If not, the row is skipped, etc. The problem I run into is that after the text that I want has had all the blank rows removed, the code will continue executing indefinitely. I need the code to STOP after it has completed deleting the blank rows from my block of text. What I'm trying to do below is set a counter ('y') so that if 25 consecutive rows are blank, then the code will know that the end of the text has come and it's time to end the macro. But the line "y = y + 1" generates the error "code execution has been interrupted." Any thoughts? Sub DeleteRows() Dim y As Long y = 0 Do While y < 25 If ActiveCell.Value = "" Then Selection.EntireRow.Delete y = y + 1 Else ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate y = 0 End If Loop End Sub Thanks. C. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cannot seem to Cancel EXCEL App Right Click Event using C# | Excel Programming | |||
Input Box Cancel | Excel Discussion (Misc queries) | |||
Cancel sheet change event | Charts and Charting in Excel | |||
cancel input | Excel Discussion (Misc queries) | |||
Cancel terminate event?? | Excel Programming |