Delete multiple lines

Copper Contributor

Hi there! 

I use excel for the auctions I organize on the internet. Each line contains the features of a product. When an auction ends, I manually delete the sold products one by one and repost the unsold products. This process takes some time as approximately 3000 items and 400-500 items are sold at each auction. I have a list of the line numbers of the products sold and can I delete the products in one go this way? For example, if the 2nd, 3rd, 7th and 15th products are sold out of the first 20 products, how can I delete these lines at once?


Thanks in advance.

 

Screenshot_3.png

6 Replies

@osmanmkc 

With the rows that you want to remove selected, as in your screenshot, right-click any of the selected row numbers on the left hand side, then select Delete from the context menu.

No, that's not what I was asking. This is my job. What I'm asking is how can I speed up the selection process. I have an excel file with 3000 lines and I want to delete 500 lines with specific line numbers from it, how can I speed up this process instead of selecting them one by one?
You can create a one time macro for that and have a permanent solution for your problem. If you want I can help you with it please contact me personally on my mail jdevendra6509@gmail.com

@osmanmkc 

If you use an empty column in which you enter something, for example an "x" if the row is to be deleted, you can filter the data to display only the rows with an "x", delete the filtered rows in one go, then remove the filter.

Or do you have another way to specify which rows to delete?

Yes if there any criteria on the basis of which you delete rows then we can automate that criteria

@osmanmkc 

Here is a small example with VBA.

Assume that when column "E" is on zero it deletes the respective row.

You can determine the column and value (number and / or text) yourself.

Sample file included :))

 

Sub Delrows()
   Dim i As Long
   Application.ScreenUpdating = False
   For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
      If Cells(i, 5) = "0" Then Rows(i).Delete
   Next i
   Application.ScreenUpdating = True
End Sub

 

 

I would be happy to know if I could help.

 

Nikolino

I know I don't know anything (Socrates)

 

Was the answer useful? Mark them as helpful!

This will help all forum participants.