|
本帖最后由 sj15627581616 于 2020-2-15 00:35 编辑
Sub ts()
t = Timer
Application.ScreenUpdating = False
zdh = Sheet1.Cells(Rows.Count, 1).End(3).Row
zdh1 = Sheet2.Cells(Rows.Count, 1).End(3).Row
zdl = Sheet1.Cells(1, Columns.Count).End(1).Column
zdl1 = Sheet2.Cells(1, Columns.Count).End(1).Column
With Sheet2
For q = 1 To zdl
If Sheet1.Cells(1, q) = "所属单号" Then
cx = q: Exit For
End If
Next
For w = 1 To zdl1
If .Cells(1, w) = "销售单号" Then
xsdh = w: Exit For
End If
Next
For e = 1 To zdl1
If .Cells(1, e) = "积分抵现" Then
jfdx = e: Exit For
End If
Next
End With
With Application.WorksheetFunction
For i = 2 To zdh
On Error Resume Next
Sheet1.Cells(i, zdl + 1) = .VLookup(Sheet1.Cells(i, cx), Sheet2.Range(Cells(1, xsdh), Cells(zdh1, jfdx)), 2, 0)
Next
End With
MsgBox Timer - t
Application.ScreenUpdating = True
End Sub
自行参考各种差别吧 |
|