Delete rows if condition met without using filter

sunil10007

New Member
Joined
Sep 10, 2018
Messages
2
I wanna select rows and delete them without using filter.
The reason is that the Model No. is common but customer code is different and sum of required qty. is also different.
So i want to keep only those customer code rows which sum is greater than other customer code rows.

I have a very large data so I can't do it using filter as I have also to check the sum of required quantity customer code wise.

So please help.:confused:
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Welcome to posting at MrExcel!

Could we have a small set of sample data and explain which rows should be deleted (or kept) & why in relation to that so we know how you data is laid out/sorted etc?
My signature block has help on that if you need it.
 
Last edited:
Upvote 0
Hello,

Just for your info ...

Using AutoFilter does not prevent you from checking any Sum ...
 
Upvote 0
Give this a try in a copy of your workbook.

Rich (BB code):
Sub Del_CD90()
  Dim a As Variant, b As Variant
  Dim i As Long, k As Long
 
  a = Range("B3", Range("B" & Rows.Count).End(xlUp)).Value
  ReDim b(1 To UBound(a), 1 To 1)
  For i = 1 To UBound(a)
    If a(i, 1) = "CD090" Then
      b(i, 1) = 1
      k = k + 1
    End If
  Next i
  If k > 0 Then
    Application.ScreenUpdating = False
    With Range("A3:H3").Resize(UBound(a))
      .Columns(8).Value = b
      .Sort Key1:=.Columns(8), Order1:=xlAscending, Header:=xlNo
      .Resize(k).Delete Shift:=xlUp
    End With
    Application.ScreenUpdating = True
  End If
End Sub
 
Upvote 0
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here: http://www.mrexcel.com/forum/board-announcements/99490-forum-rules.html).

This way, other members can see what has already been done in regard to a question, and do not waste time working on a question that may already be answered.

For a more complete explanation on cross-posting, see here: http://www.excelguru.ca/content.php?184).
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,636
Members
449,043
Latest member
farhansadik

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top