|
空白行対応型にしてみました。^d^
Sub ReadCSV()
Dim myPath As String
Dim Fname As String
Dim N As Integer
Dim rngDest As Range
Dim myArray As Variant
Dim D As String
Dim i As Integer
myPath = ThisWorkbook.Path & "\"
Set rngDest = Worksheets("Sheet1").Range("A1")
Application.ScreenUpdating = False
Fname = Dir(myPath & "*.csv")
Do Until Fname = ""
N = FreeFile
Open myPath & Fname For Input As #N
Do Until EOF(N)
Line Input #N, D
If D <> "" Then
myArray = Split(D, ",")
rngDest.Resize(1, UBound(myArray) + 1).Value = myArray
End If
Set rngDest = rngDest.Offset(1)
Loop
Close #N
Fname = Dir()
Loop
Application.ScreenUpdating = True
Set rngDest = Nothing
End Sub
|
|