Match column between sheet, copy offset, combine duplicate
Hi guys, need your help with below codes,it's not working correctly. The task is to match column between 2 sheets and copy offset on desired columns and combine if 2 or more matches found. Appreciate all your help. Thank you.
PHP Code:
Private Sub CommandButton1_Click() Application.ScreenUpdating = False Dim lRow As Long Dim fValue As Range Dim n As Long lRow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row For Each cell In Sheet1.Range("A1:A" & lRow) Set fValue = Sheet2.Columns("C:C").Find(cell.Value) If fValue Is Nothing Then GoTo NextCell If cell.Offset(0, 1).Value = fValue.Offset(0, 3).Value And cell.Offset(0, 2).Value = "Layer1" Then fValue.Offset(0, 2) = cell.Offset(0, 5) ElseIf cell.Offset(0, 1).Value = fValue.Offset(0, 3).Value And cell.Offset(0, 2).Value = "Layer2" Then fValue.Offset(0, 3) = cell.Offset(0, 5) ElseIf cell.Offset(0, 1).Value = fValue.Offset(0, 3).Value And cell.Offset(0, 2).Value = "Layer3" Then fValue.Offset(0, 4) = cell.Offset(0, 5) End If NextCell: Next cell Application.CutCopyMode = False Application.ScreenUpdating = True
End Sub
Last edited by keyboard_jv; 07-23-2018 at 03:54 AM.
Reason: file attached
Bookmarks