I'm working on a rather large project and one piece of it is to search for a specific column header then go down that row and search for certain values, all of which are text. It will then copy the entire row to a new worksheet. Is there an easy array search function? Below is an example of where i'm currently at with this subroutine.
Code:
Sub Arrange()
Dim wsP As Worksheet
Dim wsD As Worksheet
Dim i As Integer
Dim c As Integer
Dim FinalRow As Integer
FinalRow = Sheets("Paste Here").Range("E10000").End(xlUp).Row
Dim CS As String
LastNames = array("Duck", "Hunter", "Downer")
FirstNames = array("John", "Jim", "David")
Set wsP = Worksheets("Paste Here")
Set wsD = Worksheets("Data")
Sheets("Paste Here").Select
Range("A1").Select
With wsP.Range("A1")
For i = 1 To FinalRow
c = 0
d = 1
CS = ActiveCell
Select Case CS
Case Is = FirstNames(2)
ActiveCell.Offset(1, 0).Select
If ActiveCell = FirstNames(x) Then
ActiveCell.EntireRow.Copy Destination:=wsD.Cells(d + 1, 1)
ActiveCell.Offset(1, 0).Select
d = d + 1
Else
ActiveCell.Offset(1, 0).Select
End If
Case Else
ActiveCell.Offset(0, 1).Select
End Select
Next i
End With
Set wsP = Nothing
Set wsD = Nothing
Range("A1").Select
End Sub