Sub rs_rm() 'This is a Microsoft Excel Visual Basic for Applications utility module for merging data. ' 'Data source set and destination data set both expected to be sorted by ID columns before running this module. 'Value from data source set overwrites value in destination set by ID match. 'The identifying keys here are not expected to necessarily be unique in each ID column, 'and source data will be pasted to multiple destination rows where the identifying keys match. ' Dim d_id_r As Integer, d_id_c As Integer, d_rs_c As Integer Dim s_id_r As Integer, s_id_c As Integer, s_rm_c As Integer Dim d_id, s_id d_id_r = 2 'data source set, identifying key, starting row d_id_c = 1 'data source set, identifying key, column d_rs_c = 3 'data source set, data column d_id = Cells(d_id_r, d_id_c).Value s_id_r = 2 'destination data set, identifying key, starting row s_id_c = 5 'destination data set, identifying key, column s_rm_c = 7 'destination data set, data column s_id = Cells(s_id_r, s_id_c).Value 'loop until blank ID found, or 15-bit row limit approached Do Until (d_id = "" Or s_id = "" Or (d_id_r > 30000) Or (s_id_r > 30000)) Do Until (s_id = d_id) Or (s_id > d_id) Or s_id = "" s_id_r = s_id_r + 1 s_id = Cells(s_id_r, s_id_c).Value Loop Do Until (s_id <> d_id) 'Cells(s_id_r, s_rm_c).Value = Cells(d_id_r, d_rs_c).Value Cells(d_id_r, d_rs_c).Copy Cells(s_id_r, s_rm_c).Select ActiveSheet.Paste Cells(s_id_r, 6).Select 'this is just to conveniently see where the destination set ActiveSheet.Paste 'has been modified, by also pasting the copied data to column 6 Cells(d_id_r, 2).Value = "'''" 'here I mark what source data rows were ID matched and used, in column 2 s_id_r = s_id_r + 1 s_id = Cells(s_id_r, s_id_c).Value Loop d_id_r = d_id_r + 1 d_id = Cells(d_id_r, d_id_c).Value Loop End Sub