Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I ahve the following code that loops thru each row and if the criteria is met it deletes the row. However it runs really slowly. Is there a way to acheive the same thing more effeiciently? Thanks Sub removeNTUs() Dim xR As Long Dim xCw As Integer Dim xCA As Integer Dim wStep As String Dim AStatus As String Dim xStop As Long xCw = 19 xCA = 20 xStop = Workbooks("pipeline reporting.xls").Worksheets ("variables").Cells(2, 2).Value + 12 xR = 15 Do Debug.Print (xR) wStep = Workbooks("pipeline reporting.xls").Worksheets ("Pipeline").Cells(xR, xCw).Value AStatus = Workbooks("pipeline reporting.xls").Worksheets ("Pipeline").Cells(xR, xCA).Value If wStep = "Diary - NTU" And AStatus = "Not Taken Up" Then Rows(xR & ":" & xR).Delete Shift:=xlUp xR = xR - 1 xStop = xStop - 1 End If xR = xR + 1 Loop Until xR = xStop MsgBox ("ended") End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Efficient If's loop | Excel Programming | |||
here is my code...it's running a bit slow though..any ideas to make it more efficient? thanks | Excel Programming | |||
How can I make this code more efficient? | Excel Programming | |||
need to make code more efficient (if possible) | Excel Programming | |||
Loop more efficient ? | Excel Programming |