Sub 按鈕1_Click()
Dim Arr, Brr(1 To 20, 1 To 1), i&, n%
fs = ThisWorkbook.Path & "\sun03.txt"
Open fs For Input As #1
i = 1 '從第一格開始匯入
Do While Not EOF(1) ' 執行迴圈直到檔尾為止。
Line Input #1, TextLine
Cells(i, 1) = TextLine
i = i + 1
Loop
Close #1
Arr = Range([a1], [a65536].End(3))
For i = 1 To UBound(Arr)
n = n + 1: Brr(n, 1) = Arr(i, 1)
If n = 20 Or i = UBound(Arr) Then
With Sheets.Add(after:=Sheets(Sheets.Count))
.[a1].Resize(20) = Brr
End With
n = 0: Erase Brr
End If
Next
End Sub作者: dou10801 時間: 2021-10-27 12:17