ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Do Loop (https://www.excelbanter.com/excel-discussion-misc-queries/59535-do-loop.html)

Noemi

Do Loop
 
Hi
I have a Do Loop which performs the task required however it does leave one
row left which it should also delete.

In one column I have a K and then numbers or Ktba. The Do Loop is to go down
the column to find and delete all the rows with Ktba in them and only stop
the loop when the column is empty.

The loop does work except it leaves a Ktba behind and I dont understand why.

IF you can see what is wrong with my code and advise me I would really
appreciate it.

count = 4

Do
If Application.Range("J" & count) = "Ktba" Then
Application.Range("J" & count).Select
Selection.EntireRow.Delete
End If

count = count + 1

Loop Until Application.Range("J" & count).value = ""

thanks
Noemi


All times are GMT +1. The time now is 02:17 PM.

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