Excel 怎么改 用vba代码提取不重复值为数组
展开全部
前两天正好找到这样一段代码,借你用一下
Dim arr, brr, crr(1 To 70), b As Boolean
b = False
Dim x%: x = 1
arr = ActiveSheet.Range(Cells(1, 1), Cells(70, 1))
brr = ActiveSheet.Range(Cells(1, 2), Cells(70, 2))
For i = 1 To UBound(arr, 1)
For j = 1 To UBound(brr, 1)
If arr(i, 1) = brr(j, 1) Then b = True: Exit For
Next
If b = False Then crr(x) = arr(i, 1): x = x + 1
b = False
Next
ActiveSheet.Cells(1, 3).Resize(x - 1, 1) = Application.Transpose(crr)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |