ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB Slows to Crawl when Deleting Rows (https://www.excelbanter.com/excel-programming/328324-vbulletin-slows-crawl-when-deleting-rows.html)

forbesy

VB Slows to Crawl when Deleting Rows
 
The macro is pretty basic. If the activecell has a value of 0 then the
entire row is deleted if not 0 then offset to the next row down and loop.
The problem seems to be that the spreadsheet has several dozon groupings.
After about 100 rows into the process the looping slows to one row every few
seconds and it just keeps getting slower and sloower and sloowweeerrr.

Any thoughts/suggestions?

Windows XP SP1
512 MB memory
Excel 2002 SP2

Sub DeleteZeroDataIAN()
Application.ScreenUpdating = False
Range("bl10").Activate
Do Until i = 650

If ActiveCell.Value < "" And ActiveCell.Value = 0 Then

ActiveCell.EntireRow.Delete

Else
ActiveCell.Offset(1).Activate


End If

i = i + 1

Loop

Application.ScreenUpdating = True
End Sub



Doug Glancy

VB Slows to Crawl when Deleting Rows
 
All those activates will slow things down. Take a look he

http://www.rondebruin.nl/delete.htm#AutoFilter

hth,

Doug

"forbesy" wrote in message
...
The macro is pretty basic. If the activecell has a value of 0 then the
entire row is deleted if not 0 then offset to the next row down and loop.
The problem seems to be that the spreadsheet has several dozon groupings.
After about 100 rows into the process the looping slows to one row every

few
seconds and it just keeps getting slower and sloower and sloowweeerrr.

Any thoughts/suggestions?

Windows XP SP1
512 MB memory
Excel 2002 SP2

Sub DeleteZeroDataIAN()
Application.ScreenUpdating = False
Range("bl10").Activate
Do Until i = 650

If ActiveCell.Value < "" And ActiveCell.Value = 0 Then

ActiveCell.EntireRow.Delete

Else
ActiveCell.Offset(1).Activate


End If

i = i + 1

Loop

Application.ScreenUpdating = True
End Sub





forbesy

VB Slows to Crawl when Deleting Rows
 
Thanks Doug, that worked perfectly!

"Doug Glancy" wrote:

All those activates will slow things down. Take a look he

http://www.rondebruin.nl/delete.htm#AutoFilter

hth,

Doug

"forbesy" wrote in message
...
The macro is pretty basic. If the activecell has a value of 0 then the
entire row is deleted if not 0 then offset to the next row down and loop.
The problem seems to be that the spreadsheet has several dozon groupings.
After about 100 rows into the process the looping slows to one row every

few
seconds and it just keeps getting slower and sloower and sloowweeerrr.

Any thoughts/suggestions?

Windows XP SP1
512 MB memory
Excel 2002 SP2

Sub DeleteZeroDataIAN()
Application.ScreenUpdating = False
Range("bl10").Activate
Do Until i = 650

If ActiveCell.Value < "" And ActiveCell.Value = 0 Then

ActiveCell.EntireRow.Delete

Else
ActiveCell.Offset(1).Activate


End If

i = i + 1

Loop

Application.ScreenUpdating = True
End Sub







All times are GMT +1. The time now is 09:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com