ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find all from a list (https://www.excelbanter.com/excel-discussion-misc-queries/47554-find-all-list.html)

vanjan

Find all from a list
 
I have data that I past into a spread sheet that I download daily of over
1000 rows with names and data columns. I have a list of 15 people listed on
this list that I need to find their records, delete the others and end up
with only those 15 peoples data. What is the best way for me to accomplish
this.

Ron de Bruin

Hi

You can try this one with the names in column A
Enter all names in the array
Array("jelle", "ron", "dave")

you can also make a list on a worksheet if you want

Sub Example2()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = 1000
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "A").Value) Then
'Do nothing, This avoid a error if there is a error in the cell

ElseIf IsError(Application.Match(.Cells(Lrow, "A").Value, _
Array("jelle", "ron", "dave"), 0)) Then .Rows(Lrow).Delete

End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"vanjan" wrote in message ...
I have data that I past into a spread sheet that I download daily of over
1000 rows with names and data columns. I have a list of 15 people listed on
this list that I need to find their records, delete the others and end up
with only those 15 peoples data. What is the best way for me to accomplish
this.





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

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