Sub aa() Dim x, x1, x2, x3, z, r, r1 As Long, y, p% Application.DisplayAlerts = False On Error Resume Next Columns(2).TextToColumns DataType:=xlDelimited, TextQualifier:=xlDoubleQuote x = [a65536].End(xlUp).Row y = Application.WorksheetFunction.CountA(Columns(1)) For z = 1 To y p = Application.WorksheetFunction.CountA(Rows(z)) Range(Cells(z, 2), Cells(z, p)).Copy r = [b65536].End(xlUp).Row Cells(r + 2, 2).PasteSpecial Paste:=xlPasteAll, Transpose:=True r1 = [b65536].End(xlUp).Row x1 = [a65536].End(xlUp).Row Range(Cells(x1 + 2, 1), Cells(r1, 1)).Value = Cells(z, 1).Value Next z x2 = [a65536].End(xlUp).Row For x3 = x + 2 To x2 If Application.WorksheetFunction.CountA(Rows(x3)) = 0 Then Rows(x3).Delete End If Next x3 Application.DisplayAlerts = True End Sub
试一下看行不行, |