|
楼主 |
发表于 2019-4-8 23:52
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 saiwet 于 2019-4-9 13:43 编辑
Sub 不同工作表纵向转横向()
Dim d, arr, brr
Set d = CreateObject("Scripting.Dictionary")
arr = Sheet1.Range("A3").CurrentRegion
ReDim brr(1 To UBound(arr), 1 To 12)
For i = 2 To UBound(arr)
s = arr(i, 1) & arr(i, 2) & arr(i, 3) & arr(i, 4)
If d(s) = "" Then
m = m + 1: d(s) = m
For j = 1 To UBound(arr, 2)
brr(m, j) = arr(i, j)
Next
Else
brr(d(s), 12) = arr(i, 5)
End If
Next
Sheet2.[A4].Resize(m, 12) = brr
End Sub
|
|