Greetings,
Hope someone can assist. I have two large set of data, 20,000 lines in each of accounts and security names. Need to find all the rows that have matching accounts and names listed in spreadsheet 1(Detail) and search in sheet2() then copy the row containing the asset information into a new spreadsheet. I should have multiple results with the same asset name but in different accounts.I'd like use
Select name(column E until Final row) in Sheet 1 (Detail)
Search Asset name in sheet2 for asset and matching account number
If the asset and account number both match, copy the entire row into sheet 3
I stat
Sub search_and_extract()
'Find records that match criteria and paste to the report sheet
Dim Nir As Worksheet
Dim Detail As Worksheet 'pull asset and account search in Nir worksheet
Dim reportsheet As Worksheet 'where data will be copied
Dim Assetname As String
Dim Accountnumber As String
Dim finalrow As Integer
Dim i As Integer 'row counter
'Set variables
Set Detail = Sheet1
Set Nir= Sheet2
Set reportsheet = Sheet3
Assetname = Sheets("Detail").Range(E2).Value 'E2 is the cell containing the asset name to search- go until the last row
For i = 2 To finalrow
If Cells(i, 1) = Assetname Then
Range(Cells(i, 2), Cells(i, 28)).Copy
finalrow.End(xlUp).Offset(1, 0).PasteSpecialxlpasteformulasnumber
Bookmarks