Sub Macro1()
Application.ScreenUpdating = True
Application.DisplayAlerts = False
Set sh = ThisWorkbook.Sheets(1)
sh.Cells.Clear
fpth = ThisWorkbook.Path & "\源数据.txt"
Workbooks.OpenText Filename:= _
fpth, Origin:=936, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), _
Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1)), TrailingMinusNumbers:=True
Set wb = ActiveWorkbook
wb.Sheets(1).UsedRange.Copy sh.[a1]
wb.Close False
arr = sh.UsedRange
Set d = CreateObject("scripting.dictionary")
For j = 1 To UBound(arr)
If d.exists(arr(j, 1)) Then
Set d(arr(j, 1)) = Union(sh.Cells(j, 2).Resize(1, UBound(arr, 2) - 1), d(arr(j, 1)))
Else
Set d(arr(j, 1)) = sh.Cells(j, 2).Resize(1, UBound(arr, 2) - 1)
End If
Next j
For j = 0 To d.Count - 1
ThisWorkbook.Sheets(2).Cells.Clear
d.items()(j).Copy ThisWorkbook.Sheets(2).[a1]
ThisWorkbook.Sheets(2).Copy
Set wb = ActiveWorkbook
wb.SaveAs Filename:=ThisWorkbook.Path & "\" & d.keys()(j) & ".txt", FileFormat:=xlText, CreateBackup:=False
wb.Close False
Next j
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub