|
Private Sub Worksheet_Change(ByVal Target As Range)
Dim arr, brr, c As Object, i%, sh5, sh1
If Target.Row = 18 And Target.Column = 12 Then
Set c = CreateObject("Scripting.dictionary")
Set sh5 = Sheets
Set sh1 = Sheets
sh1.[a1:c60000].ClearContents
arr = sh5.[a1].CurrentRegion
For i = 2 To UBound(arr)
If arr(i, 3) = sh1.[l18].Value Then
s = arr(i, 1) & arr(i, 3) & arr(i, 2)
If Not c.exists(s) Then
c(s) = Array(arr(i, 1), arr(i, 2), arr(i, 3))
Else
c(s) = Array(arr(i, 1), c(s)(1) + arr(i, 2), arr(i, 3))
End If
End If
Next i
IM = c.items
sh1.[a2].Resize(c.Count, 3) = Application.Transpose(Application.Transpose(IM))
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range) 2代码
Range("m16").Select
If ActiveCell.Value > 50000 Then
Macro2
End If
Range("m16").Select
If ActiveCell.Value < 500 Then
Macro1
End If
End Sub
|
|