use this macro on Update Data from master, the 2 wb must be in the same directory, master wb not open
Public Sub m()
Dim wk1 As Workbook, wk2 As Workbook, sh1 As Worksheet, sh2 As Worksheet
Dim rng2 As Range, rfound As Range
Dim LR As Long
Set wk1 = ThisWorkbook
Set wk2 = Workbooks.Open(ThisWorkbook.Path & "\Master File with over 2 lakh of data_sample.xlsx")
Set sh1 = wk1.Worksheets("Sheet1")
Set sh2 = wk2.Worksheets("Sheet1")
Set rng2 = sh2.UsedRange
Application.ScreenUpdating = False
LR = sh1.Range("A" & Rows.Count).End(xlUp).Row
' Stop
With sh1
For j = 2 To LR
regID = .Cells(j, 1).Value
Set rfound = rng2.Find(What:=regID, After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not rfound Is Nothing Then
frow = rfound.Row
.Cells(j, 3).Value = sh2.Cells(frow, 3).Value
.Cells(j, 4).Value = sh2.Cells(frow, 5).Value
.Cells(j, 5).Value = sh2.Cells(frow, 6).Value
.Cells(j, 6).Value = sh2.Cells(frow, 8).Value
.Cells(j, 7).Value = sh2.Cells(frow, 9).Value
.Cells(j, 8).Value = sh2.Cells(frow, 10).Value
End If
Next
End With
wk2.Close
End Sub
Bookmarks