|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub TEST()
Dim arr, vData, i&, j&, R&, dic As Object
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
arr = Sheets(1).[A1].CurrentRegion ': R = 1
[A1].CurrentRegion.Offset(1).Clear
vData = [A1].CurrentRegion.Resize(UBound(arr) * 6): R = 1
For i = 2 To UBound(arr)
If Not dic.exists(arr(i, 1)) Then
For j = 3 To UBound(arr, 2) Step 3
If arr(i, j) <> "" Then
R = R + 1: vData(R, 1) = arr(i, 1): vData(R, 2) = arr(i, 2)
For k = 3 To 5
vData(R, k) = arr(i, (j - 3) + k)
Next k
End If
Next j
dic(arr(i, 1)) = ""
End If
Next i
[A1].Resize(R, UBound(vData, 2)) = vData
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
|