1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
Sub MAJ_WB_2020()
Dim Sh1 As Worksheet, Sh2 As Worksheet
Dim Sh1LstRw As Long, Sh2LstRw As Long, x As Long
Dim DataSh1 As Range
Set Sh1 = ThisWorkbook.Worksheets("AAA")
Set Sh2 = ThisWorkbook.Worksheets("BBB")
Sh1LstRw = Sh1.Range("A" & Rows.Count).End(xlUp).Row
Sh2LstRw = Sh2.Range("A" & Rows.Count).End(xlUp).Row
Set DataSh1 = Sh1.Range("A2:AI" & Sh1LstRw)
For x = 2 To Sh2LstRw
On Error Resume Next
Sh2.Range("L" & x).Value = Application.WorksheetFunction.VLookup( _
Sh1.Range("A" & x).Value, DataSh1, 12, False)
Sh2.Range("H" & x).Value = Application.WorksheetFunction.VLookup( _
Sh1.Range("A" & x).Value, DataSh1, 8, False)
Sh2.Range("I" & x).Value = Application.WorksheetFunction.VLookup( _
Sh1.Range("A" & x).Value, DataSh1, 9, False)
Sh2.Range("J" & x).Value = Application.WorksheetFunction.VLookup( _
Sh1.Range("A" & x).Value, DataSh1, 10, False)
Sh2.Range("K" & x).Value = Application.WorksheetFunction.VLookup( _
Sh1.Range("A" & x).Value, DataSh1, 11, False)
Sh2.Range("AG" & x).Value = Application.WorksheetFunction.VLookup( _
Sh1.Range("A" & x).Value, DataSh1, 33, False)
Sh2.Range("AH" & x).Value = Application.WorksheetFunction.VLookup( _
Sh1.Range("A" & x).Value, DataSh1, 34, False)
Sh2.Range("AI" & x).Value = Application.WorksheetFunction.VLookup( _
Sh1.Range("A" & x).Value, DataSh1, 35, False)
Next x
End Sub |