Compare columns in two sheets and, where there is a match, copy data from a third column

RLloyd

New Member
Joined
Aug 14, 2008
Messages
47
I have a workbook with two sheets. The first sheet "Master Data" has 2300 rows of alpha-numeric data in Column "A". The second sheet (called Assessment") has the same alpha-numeric data as sheet Master Data and is in column "C", but it's not in the same order as in the first sheet. The second sheet also has in column "L" status data.

This task will occur weekly, so I would benefit from VB code that will compare the data in both column A in the Master Data sheet and column C in the Assessment sheet. Where there is a match, the corresponding data in Assessment sheet column L should be copied to column B in the Master Data sheet.

Many thanks, RL
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Minimal but should get you started:
Code:
Sub GetStatus()
    Dim MasterList As Range, Assessment As Range, StatusData As String
    Dim fnd As Range, c As Variant
    Sheets("Assessment").Select
    Set Assessment = Range(Cells(1, 3), Cells(Rows.Count, 3).End(xlUp))
    Sheets("Master Data").Select
    Set MasterList = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
    For Each c In MasterList
        Set fnd = Assessment.Find(c, , xlValues, xlWhole)
        If Not fnd Is Nothing Then
            c.Offset(, 1) = fnd.Offset(, 9)
        End If
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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