|
'会有假死机现象,可以在do...loop中加入doevents
Option Explicit
Const NUM = 10 ^ 5
Sub test()
Dim i, j, t, n, filename, m
ReDim arr(1 To NUM, 1 To 11)
Application.ScreenUpdating = False
Cells.ClearContents
filename = "d:\abc.csv" '文件位置,自己修改
Open filename For Input As #1
Do While Not EOF(1)
Line Input #1, t
If InStr(t, ",") Then
t = Split(t, ",")
n = n + 1
For j = 0 To UBound(t)
arr(n, j + 1) = t(j)
Next
If n = NUM Then
Cells(1, m + 1).Resize(NUM, UBound(arr, 2)) = arr
n = 0: m = m + 12
ReDim arr(1 To NUM, 1 To 11)
End If
End If
Loop
Close #1
Application.ScreenUpdating = True
End Sub |
|