Please try the following code
Public Sub updateTrackerWorksheet()
'#
'# declare private variables
'#
Dim pvt_obj_Tracker As Excel.Worksheet
Dim pvt_obj_Index As Object
Dim pvt_lng_RowNumber As Long
Dim pvt_str_KeyValue As String
'#
'# create a dictionary object to act as an index for all rows on the tracker
'# worksheet
'#
Set pvt_obj_Tracker = ThisWorkbook.Worksheets("SAP Tracker")
Set pvt_obj_Index = CreateObject("Scripting.Dictionary")
With pvt_obj_Tracker
For pvt_lng_RowNumber = 2 To .Cells(.Rows.Count, "D").End(xlUp).Row
pvt_str_KeyValue = .Cells(pvt_lng_RowNumber, "D").Value & "|" & .Cells(pvt_lng_RowNumber, "E").Value
If Not pvt_obj_Index.Exists(pvt_str_KeyValue) Then
pvt_obj_Index.Add pvt_str_KeyValue, pvt_lng_RowNumber
End If
Next pvt_lng_RowNumber
End With
'#
'# process all rows from the SAP download worksheet and for each key (combined column A and B) determine
'# if a matching row exists on the Tracker worksheet - if found updated column C on the tracker worksheet
'# with the value of column C on the download worksheet
'#
With ThisWorkbook.Worksheets("SAP Download")
For pvt_lng_RowNumber = 2 To .Cells(.Rows.Count, "D").End(xlUp).Row
pvt_str_KeyValue = .Cells(pvt_lng_RowNumber, "A").Value & "|" & .Cells(pvt_lng_RowNumber, "B").Value
If pvt_obj_Index.Exists(pvt_str_KeyValue) Then
pvt_obj_Tracker.Cells(pvt_obj_Index(pvt_str_KeyValue), "C").Value = .Cells(pvt_lng_RowNumber, "C").Value
End If
Next pvt_lng_RowNumber
End With
'#
'# housekeeping
'#
Set pvt_obj_Index = Nothing
End Sub
1. correct the names of the worksheets in the code
2. remove all formulas from your workbook
3. run the code after pasting the data in the download worksheet
Bookmarks