|
参与一下。。。
- Private Sub Worksheet_Change(ByVal T As Range)
- ReDim brr(1 To 10000, 1 To 6)
- If T.Column = 1 And T.Row >= 2 Then
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("总库存")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 7)
- End With
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- If Not d.exists(s) Then Set d(s) = CreateObject("Scripting.Dictionary")
- d(s)(i) = i
- Next
- st = T.Value
- m = 0
- For Each k In d.keys
- If st = k Then
- For Each kk In d(k).keys
- m = m + 1
- For j = 2 To UBound(arr, 2)
- brr(m, j - 1) = arr(kk, j)
- Next
- Next
- End If
- Next
- Me.[b2:g1000] = ""
- Me.[b2].Resize(m, 6) = brr
- End If
- End Sub
复制代码
|
|