Match Cell Data Based on Cell Value and Iterate Down Rows

Hello_World_Print

New Member
Joined
Jun 15, 2022
Messages
3
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
PLEASE NEED HELP

I have a sheet ("Sheet D") with different column headings from ("Sheet A") except for a part numbers column. I need to be able to go to ("Sheet D") and iterate down each row for the part number and find the matching part number in ("Sheet A"). If the part number from ("Sheet D") is found in ("Sheet A"), I need to copy that entire row where it was found and paste it into ("Sheet D") starting in column K. If the part number is not found in ("Sheet A"), I want it to skip that row in ("Sheet D") and leave it blank and move to the row below it and repeat. So far, I have this code but it doesn't work:

VBA Code:
Sub Excel()

Dim N As Long
Dim i As Long
Dim j As Long
SN As Range
SNRow As Long

With Worksheets("Sheet A").Columns("A")
        N = Cells(Rows.Count, "A").End(xlUp).Row
        
        For i = 2 To N
              For j = 2 To N
                    Set SN = .Find(Worksheets("Sheet D").Cells(i, "A").Value, LookIn:=xlValues)
                    If SN Is Nothing Then
                            GoTo NextIteration
                    Else
                    SNRow = SN.Row
                    Range(Sheets("Sheet A").Cells(SNRow, 1), Sheets("Sheet A").Cells(SNRow, 10)).Copy Range(j, "K")
                    End If
NextIteration:
               Next j
        Next i

End With
End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top