请教:怎样才能把数据转换成如图这样
excel吧
全部回复
仅看楼主
level 6
jincai688 楼主
有一个数据表,如上图左边。
请问怎么才能快速转换成右边这样?
2022年03月07日 12点03分 1
level 11
Option Explicit
Sub abc()
 Dim i, a, m, t, d
 a = [a1].CurrentRegion.Resize(, 2).Value
 Set d = CreateObject("scripting.dictionary")
 For i = 2 To UBound(a)
  d(a(i, 1)) = d(a(i, 1)) & Space(1) & a(i, 2)
 Next
 For Each i In d.keys
  m = m + 1
  t = Split(d(i))
  t(0) = i
  Cells(m + 1, "f").Resize(, UBound(t) + 1) = t
 Next
End Sub
2022年03月07日 13点03分 2
谢谢![大拇指]
2022年03月07日 13点03分
1