|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
代码如下。。。
Private Sub Worksheet_Change(ByVal Target As Range)
Dim brr
Application.EnableEvents = False
If Target.Address = "$G$1" Then
m = Cells(33, "g").End(3).Row
arr = Range("g3:g" & m)
If m <= 2 Then Exit Sub
arr2 = Range(Cells(1, "i"), Cells(1, "r"))
ReDim brr(1 To UBound(arr), 1 To 10)
For i = 1 To UBound(arr)
For j = 1 To 10
If arr2(1, j) = arr(i, 1) Then
brr(i, j) = arr2(1, j)
Else
brr(i, j) = "#N/A"
End If
Next
Next
Cells(3, "i").Resize(UBound(arr), 10) = brr
End If
If Target.Address = "$AH$1" Then
arr = [w10:w210]
arr(UBound(arr), 1) = 0
brr = [ac10:ac210]
ReDim crr(1 To 1000, 0)
For i = 1 To 17
brr(i, 1) = Empty
Next
For i = 1 To UBound(arr)
If IsNumeric(arr(i, 1)) And Len(brr(i, 1)) <> 0 Then
n = n + 1
crr(n, 0) = brr(i, 1)
End If
Next
[ah196].Offset(-n + 1).Resize(n) = crr
Beep
End If
Application.EnableEvents = True
End Sub
|
评分
-
2
查看全部评分
-
|