View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
colwyn[_22_] colwyn[_22_] is offline
external usenet poster
 
Posts: 1
Default Can anyone correct this code ???


This code is designed to delete rows which dont have data in column I.
However, after several hours running, it just freezes up the s/s and I
have to close it down.



Code:
--------------------

Sub delRows()
Dim rClear As Range
Dim Rw As Long
Dim LastRw As Long


With ActiveSheet
LastRw = .Cells(.Rows.Count, 1).End(xlUp).Row
For Rw = LastRw To 3 Step -1
If Application.WorksheetFunction.CountA(.Range(.Cells (Rw, 1), .Cells(Rw, 10))) = 2 Then
If rClear Is Nothing Then
Set rClear = .Cells(Rw, 1)
Else: Set rClear = Union(rClear, Cells(Rw, 1))
End If
End If
Next Rw
rClear.EntireRow.Delete
End With
End Sub

--------------------




Can anyone tell me what is wrong and/or correct the code to make it
workable??
Big thanks.
Colwyn.


--
colwyn
------------------------------------------------------------------------
colwyn's Profile: http://www.thecodecage.com/forumz/member.php?userid=34
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=44836