|
- Sub 简单独立合并()
- Dim Arr, i, j, k, n, m, Dic As Object, Brr
- Set Dic = CreateObject("Scripting.Dictionary")
- Arr = [a1].CurrentRegion.Resize(999) '给足够的行数
- ReDim Brr(1 To 9) '给足够的列数
- For i = 1 To UBound(Arr, 2)
- If Not Dic.Exists(Arr(1, i)) Then
- Dic(Arr(1, i)) = Dic.Count + 1
- k = Dic(Arr(1, i)): n = 1
- For j = 1 To UBound(Arr)
- If Arr(j, i) = "" Then Exit For
- Arr(n, k) = Arr(j, i)
- n = n + 1
- Next
- Brr(k) = n
- Else
- k = Dic(Arr(1, i)): n = Brr(k)
- For j = 2 To UBound(Arr)
- If Arr(j, i) = "" Then Exit For
- Arr(n, k) = Arr(j, i)
- n = n + 1
- Next
- Brr(k) = n
- End If
- Next
- '输出的左上角自己改变
- [I1].Resize(UBound(Arr) - 1, Dic.Count) = Arr
- Set Dic = Nothing
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|