|
Sub 工资单()
Dim i As Integer, j As Integer
Dim ar1 As Variant
ar1 = Sheets("工资单全字段版-汇总").[a1048576].End(xlUp).Row
arr1 = Sheets("工资单全字段版-汇总").Range("A2:gk" & Sheets("工资单全字段版-汇总").Cells(Rows.Count, "A").End(xlUp).Row)
arr2 = Sheets("工资单全字段版-终端").Range("a2:fw" & Sheets("工资单全字段版-终端").Cells(Rows.Count, "a").End(xlUp).Row)
For i = 1 To UBound(arr1)
For j = 1 To UBound(arr2)
For n = 1 To 193
For k = 1 To 179
If arr1(i, 1) = arr2(j, 1) And arr1(1, n) = arr2(1, k) Then
arr1(i, n) = arr2(j, k)
GoTo ar1
End If
Next
Next
Next
ar1:
Next
Sheets("工资单全字段版-汇总").Range("A2:gk" & Sheets("工资单全字段版-汇总").Cells(Rows.Count, "A").End(xlUp).Row) = arr1
End Sub
for N forK 自己假设的,但数据出不来,如果把 N ,K换成具体的数字,数据可以出来。我的思路是把N,K具体的数据换成我想要的变量,就可以实现了,但想法好像好像不对,不知道有没有方式可以实现。
|
|