Macro to match specific value in one sheet and replace the entire row value in other sheet

Chandresh

Board Regular
Joined
Jul 21, 2009
Messages
146
I have two different sheets - 1) “Working” 2) “data”

Working sheet has data in column from 1 to 14 , 14th column has unique values like ABC, XYZ ,LMN and so on
I need a macro to find the unique value from working sheet in Data sheet if the unique value matches then macro should copy first 5 column data value from working sheet and paste it in data sheet.
Example if macro finds ABC in “data” sheet on 10th row then macro should copy the data value from working and paste the data on A10:E10 and it should loop.

Thanks in advance for your help
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
See if this does what you want.
Code:
Sub t()
Dim sh1 As Worksheet, sh2 As Worksheet, c As Range, fn As Range
Set sh1 = Sheets("Working")
Set sh2 = Sheets("Data")
    For Each c In sh1.Range("N2", sh1.Cells(Rows.Count, "N").End(xlUp))
        Set fn = sh2.UsedRange.Find(c.Value, , xlValues, xlWhole)
            If Not fn Is Nothing Then
                sh1.Cells(c.Row, 1).Resize(, 5).Copy sh2.Cells(Rows.Count, 1).End(xlUp)(2)
            End If
    Next
End Sub

Since no column was specified in Data sheet, I assumed the unique value could be anywhere in the rows if the sheet.
 
Upvote 0

Forum statistics

Threads
1,223,721
Messages
6,174,096
Members
452,542
Latest member
Bricklin

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