Код |
---|
Sub Результат() Dim wb1 As Workbook: Set wb1 = Workbooks("Таблица товара.xlsx") Dim wb2 As Workbook: Set wb2 = ThisWorkbook Dim sh1 As Worksheet: Set sh1 = wb1.Worksheets("Ноябрь") Dim sh2 As Worksheet: Set sh2 = wb2.Worksheets("Ноябрь") Dim y As Long Dim a As Variant With sh2 y = .Cells(Rows.Count, 4).End(xlUp).Row a = .Range(.Cells(1, 4), .Cells(y, 4)) End With Dim dic As Object Set dic = CreateObject("Scripting.Dictionary") For y = 1 To UBound(a, 1) If a(y, 1) <> "" Then dic(a(y, 1)) = y End If Next Erase a With sh1 y = .Cells(Rows.Count, 4).End(xlUp).Row a = .Range(.Cells(1, 4), .Cells(y, 4)) End With For y = 1 To UBound(a, 1) If dic.Exists(a(y, 1)) Then sh1.Rows(y).Copy sh2.Cells(dic(a(y, 1)), 1) End If Next End Sub |
Есть код. Его надо переделать и внедрить в гугл таблицу