![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/e850352ac65c103896396806bb119313b17e89ab?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
'说实话,这个对于新手是很难得!
'举个例子arr()数组为1-10的10个值,brr()数组为1-3的3个值
'去重之后的数组赋值到crr(),然后打印验证。
'有问题可以问我,运行效果如上图,代码如下:
Private Sub Command1_Click()
Dim arr(10), brr(3) As Integer
Dim crr(10)
Dim i, j, x, n, s As Integer
Dim a, b As Integer
m = 1
For i = 1 To 10
arr(i) = i
Next i '将1-10赋值给数组arr
brr(1) = 1
brr(2) = 2
brr(3) = 3 '将1-3赋值给数组brr
For j = 1 To UBound(brr())
x = 1
For x = 1 To UBound(arr())
If arr(x) = brr(j) Then
For n = x To UBound(arr) - 1
arr(n) = arr(n + 1)
Next n
s = s + 1
End If
Next x
Next j
Print "去重复后数组元素为:"
For a = 1 To UBound(arr()) - s
crr(a) = arr(a)
Print crr(a);'最终去重后的数据存入crr数组并打印验证
Next a
End Sub