Sub TEST()
Dim xR As Range, xD, U&, N&, T$
Set xD = CreateObject("Scripting.Dictionary")
With Sheets("工作表2")
.Cells.Clear: .[a1] = "Frequency"
For Each xR In Range([工作表1!A2], [工作表1!A1].Cells(Rows.Count, 1).End(xlUp))
If xR.Row = 1 Or Val(xR) = 0 Or Val(xR(1, 8)) = 0 Then GoTo 101
T = Format(xR, "0000_") & xR & "Vpp"
U = xD(T)
If U = 0 Then N = N + 1: U = N: xD(T) = N: .Cells(U + 1, 1) = T
T = xR(1, 8)
If xD(T & "/") = 0 Then .Cells(1, Val(T) + 1) = T: xD(T & "/") = 1
xR(1, 9).Copy .Cells(U + 1, Val(T) + 1)
101: Next
End With
If N = 0 Then Exit Sub
On Error Resume Next
With Sheets("工作表2")
.Rows(1).SpecialCells(xlCellTypeBlanks).EntireColumn.Delete
.UsedRange.Sort Key1:=.Range("A1"), Order1:=xlAscending, Header:=xlYes '由小而大排序
'.UsedRange.Sort Key1:=.Range("A1"), Order1:=xlDescending, Header:=xlYes '由大而小排序
.Columns(1).Replace "*_", "", Lookat:=xlPart
.Select
End With
End Sub