vba支持多个数
答案:2 悬赏:60 手机版
解决时间 2021-11-14 08:54
- 提问者网友:富士山上尢
- 2021-11-13 22:17
vba支持多个数
最佳答案
- 五星知识达人网友:末日狂欢
- 2021-11-13 23:16
Sub Test2()
Dim Arr, Brr, i&, j%, x, y, n
Arr = [a10].CurrentRegion
[J12:AP12] = ""
Brr = [J11:AP12]
x = [j10:l10]
For i = 1 To UBound(x, 2)
If x(1, i) > 0 Then y = y + 1
Next
For i = 2 To UBound(Arr) - 1
n = 0
For j = 3 To UBound(Arr, 2)
For k = 1 To UBound(x, 2)
If Arr(i, j) = x(1, k) Then n = n + 1
Next
Next
If n = y Then
For j = 1 To UBound(Brr, 2)
For k = 3 To UBound(Arr, 2)
If Arr(i + 1, k) = Brr(1, j) Then
Brr(2, j) = Brr(2, j) + 1
End If
Next k
Next j
End If
Next i
[j11].Resize(2, UBound(Brr, 2)) = Brr
End Sub追问果然是高手
Dim Arr, Brr, i&, j%, x, y, n
Arr = [a10].CurrentRegion
[J12:AP12] = ""
Brr = [J11:AP12]
x = [j10:l10]
For i = 1 To UBound(x, 2)
If x(1, i) > 0 Then y = y + 1
Next
For i = 2 To UBound(Arr) - 1
n = 0
For j = 3 To UBound(Arr, 2)
For k = 1 To UBound(x, 2)
If Arr(i, j) = x(1, k) Then n = n + 1
Next
Next
If n = y Then
For j = 1 To UBound(Brr, 2)
For k = 3 To UBound(Arr, 2)
If Arr(i + 1, k) = Brr(1, j) Then
Brr(2, j) = Brr(2, j) + 1
End If
Next k
Next j
End If
Next i
[j11].Resize(2, UBound(Brr, 2)) = Brr
End Sub追问果然是高手
全部回答
- 1楼网友:鸠书
- 2021-11-14 00:44
Set arr1 = Sheets("sheet1").Range("a4:c4")Set arr2 = Sheets("sheet1").Range("d5:f5")arr3 = Union(arr1, arr2)
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯