Maybe:
Sub tuanfeng()
Dim y As Long
Dim z As Long
Dim rcell As Range
Dim x As Integer
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Range("B1:B" & Range("A" & Rows.count).End(3)(1).Row).Select
Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, Other:=True, FieldInfo:= _
Array(Array(1, 1), Array(2, 1), Array(3, 1)), TrailingMinusNumbers:=True
For z = Range("A" & Rows.count).End(3)(1).Row To 2 Step -1
x = 1
For y = 3 To ActiveSheet.UsedRange.Columns.count + 1
If Cells(z, y).Value <> "" Then
Cells(z, y).offset(1).EntireRow.Insert
Cells(z + 1, "A").Value = Cells(z, "A").Value
Cells(z, y).Cut Cells(z + 1, "B")
Cells(z + 1, "C").Value = x
End If
x = x + 1
Next y
Next z
For Each rcell In Range("C2:C" & Range("A" & Rows.count).End(3)(1).Row)
If rcell.Value <> "" And rcell.offset(1).Value <> "" Then
Range(Cells(rcell.Row, "A"), Cells(rcell.Row + 1, "C")).Select
Selection.Sort Key1:=Range("C" & rcell.Row), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range(Cells(rcell.Row, "C"), Cells(rcell.Row + 1, "C")).Clear
End If
Next rcell
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Bookmarks