|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参与一下,参考代码:
- Sub test()
- Dim Dic As Object, Arr, i&, j&, tmPstr$, mcol&
- Set Dic = CreateObject("scripting.dictionary")
- With Sheet1
- Arr = .[b2].CurrentRegion
- For j = 1 To UBound(Arr, 2)
- tmPstr = ""
- For i = 1 To UBound(Arr, 1)
- If tmPstr = "" Then tmPstr = Arr(i, j) Else tmPstr = tmPstr & Chr(10) & Arr(i, j)
- Next i
- Dic(tmPstr) = ""
- Next j
-
- ReDim Brr(1 To UBound(Arr, 1), 1 To Dic.Count)
- mcol = 0
- For Each d In Dic.keys
- mcol = mcol + 1
- Trr = Split(d, Chr(10))
- For i = 0 To UBound(Trr)
- Brr(i + 1, mcol) = Val(Trr(i))
- Next i
- Next d
-
- End With
- With Sheet2
- .UsedRange.ClearContents
- .[b2].Resize(UBound(Brr, 1), UBound(Brr, 2)) = Brr
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|