I have some code that runs a search on the second sheet, copy's the matching row data into the specified location the first sheet. Currently It grabs the first row and copies the information into 'Work Listings" sheet, I A) need it to loop for other rows with matching names in the column A and paste the matching data underneath, and if no matching names are found in column A to search column B and copy the matching row data.
Here is what I have so far, which works, I just cant wrack my brains on how to get the loops to work. Any help would be great!!
Sub Filldata()
Dim nxtRow As Integer
ActiveSheet.Unprotect
With Worksheets("Destinations").Range("A:A")
Set c = .Find(Worksheets("Week Listings").Cells(17, 3).Value, LookIn:=xlValues)
If c Is Nothing Then
Range("A20") = "Not Found"
Range("B20") = "Not Found"
LCSearch.Hide
Select Case MsgBox("ESA code entered is invalid, please check. If it aligns with that shown on the order, take action to have the order corrected.", vbOKOnly + vbDefaultButton1, "Error")
Case vbOK
End Select
Else
ActiveSheet.Unprotect
mydest = c.Row
Range("A20") = Worksheets("Destinations").Cells(mydest, 1)
Range("B20") = Worksheets("Destinations").Cells(mydest, 2)
Range("C20") = Worksheets("Destinations").Cells(mydest, 3)
Range("D20") = Worksheets("Destinations").Cells(mydest, 4)
Range("E20") = Worksheets("Destinations").Cells(mydest, 5)
Range("F20") = Worksheets("Destinations").Cells(mydest, 6)
Range("G20") = Worksheets("Destinations").Cells(mydest, 7)
Range("H20") = Worksheets("Destinations").Cells(mydest, 8)
LCSearch.Hide
ActiveSheet.Unprotect
End If
End With
Worksheets("Week Listings").Range("A20").Select
End Sub