|
楼主 |
发表于 2018-9-29 09:10
|
显示全部楼层
Private Sub CommandButton1_Click()
Set d = CreateObject("scripting.dictionary")
Set dic = CreateObject("scripting.dictionary")
rs = Sheets("出库情况").Cells(Rows.Count, 1).End(xlUp).Row
arr1 = Sheets("出库情况").Range("a7:a" & rs)
arr = Sheets("出库情况").Range("g7:ak" & rs)
Sheets("出库情况").Range("g7:ak" & rs).Select
Selection.ClearContents
For i = 2 To UBound(arr1)
d(Trim(arr1(i, 1))) = i
Next i
For j = 1 To UBound(arr, 2)
dic(Trim(arr(1, j))) = j
Next j
brr = Sheets("出库每日明细数据").[a1].CurrentRegion
For i = 2 To UBound(brr)
m = d(Trim(brr(i, 2)))
n = dic(Trim(brr(i, 1)))
If m <> "" And n <> "" Then
arr(m, n) = brr(i, 4)
End If
Next i
Sheets("出库情况").Range("g7:ak" & rs) = arr
End Sub
自己改了下 不知道对不对 |
|