Hello everyone. I am new to VBA and I am new here so please be gentle. I have one Excel Workbook with 5 different sheets. I want to select a value from Column A on Sheet 1 and Search for it on Sheet 3. If it finds the matching value in Column A on Sheet 3, I want to copy the values from the current row in Columns F, G, J, K, and L. If the value isn't found on Sheet 3 then I want to copy the entire row from Sheet 1 and paste it to sheet 5.
What I am attaching will find the value from Column A in sheet 1 on Sheet 3. It will also copy and past the values from columns "H to L". The biggest issue is if a value is in Sheet 1 that isn't in Sheet 3 it gives me a error and I have to change the starting point so skip the row that can't be found. I would rather that row be copied over to a new sheet to track those and not have to manually adjust the starting point. I know it will be an If, Then, Else statement but I'm just not there yet to get everything to play nice.
'Select "Old Hierarchy" Tab 'Select the "Identifier" starting in Ai 'Copy Data from Range Hi to Li 'Activate "New Structured Tab 'Find matching identifier number in column A 'repeat process moving down one row on "Old Hierarchy" Tab 'End when all rows containing data on "old Hierarchy" has been processed Row 4709 For i = 1760 To 4709 ''setting number of times to run the script Sheets(1).Select 'selecting the "Old Hierarchy" Tab "identifier" number Range(Cells(i, 8), Cells(i, 12)).Select Selection.Copy Sheets(3).Select 'select sheet to match Identifier and paste copied data Columns("A:A").Select ' Column to search for matchng Identifier Selection.Find(What:=MTNOI, After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate j = ActiveCell.Row Range("H" & j).Select ActiveSheet.Paste Next End Sub