Find and Replace Multiple Columns in Sheet 1 Based on a Column Values in Sheet 2

adblog3

New Member
Joined
Apr 2, 2020
Messages
3
Office Version
  1. 2010
I have been searching for this for whole day and since my vba knowledge is not that great, I am unable to make this thing happen. What I am looking to do is I have a sheet 1 with 4000 records, and sheet 2 contains regular updates that we do.

I am looking to find cell value of Column A value of Sheet 2 in Column M of Sheet 1 and if it is found then replace Column B and C for the respective row in Column M.

For e.g. In the sample sheet below, Shipment No and Shipment Date needs to be updated in Sheet 1, for the specific no. of items that are now updated in sheet 2. The unique column between two sheets is Document which is Column M in Sheet 1 and Column A in Sheet 2.

On a regular basis there are 3800-4000 permanent items in sheet 1, sheet 2 just contains shipment updates which are 30-50 daily.

Any help in this regard is highly appreciated.
 

Attachments

  • sample-1.png
    sample-1.png
    66.6 KB · Views: 6
  • sample-2.png
    sample-2.png
    56.8 KB · Views: 6

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi and welcome to MrExcel.

Try this

VBA Code:
Sub Find_Replace()
  Dim c As Range, f As Range
  For Each c In Sheets("Sheet2").Range("A2", Sheets("Sheet2").Range("A" & Rows.Count).End(3))
    Set f = Sheets("Sheet1").Range("M:M").Find(c, , xlValues, xlWhole)
    If Not f Is Nothing Then f.Offset(, -11).Resize(1, 2).Value = c.Offset(, 1).Resize(1, 2).Value
  Next
End Sub
 
Upvote 0
Is it possible, to modify the macro to add a condition that if the shipment no is same as new one, don't change the date.
 
Upvote 0

Forum statistics

Threads
1,215,669
Messages
6,126,120
Members
449,293
Latest member
yallaire64

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