Sub Sample2()
Dim buf As String
Dim lin As Integer
Dim col As Integer
Const SPLITSTR = ""","""
Open "C:\WORK\20130721.csv" For Input As #1
lin = 1
col = 0
Do Until EOF(1)
Do While 1
Line Input #1, buf
tmp = SPLIT(buf, SPLITSTR)
For i = LBound(tmp) To UBound(tmp)
' 取得した行の最初の値の場合
If i = 0 Then
' 最初の値の場合はダブルクォートを削除
If Chr(34) = Left(tmp(i), 1) Then
col = col + 1
Cells(lin, col).Value = Mid(tmp(i), 2)
' 詳細情報の場合は、改行を挿入し取得値を追加
Else
MsgBox (lin)
MsgBox (col)
Cells(lin, col).Value = Cells(lin, col).Value & vbCrLf & tmp(i)
End If
' 取得した行の最初の行でなければ値を加工しない
Else
If Chr(34) = Right(tmp(i), 1) Then
col = col + 1
Cells(lin, col).Value = Mid(tmp(i), 1, Len(tmp(i)) - 1)
Exit Do
Else
col = col + 1
Cells(lin, col).Value = tmp(i)
End If
End If
Next i
Loop
col = 0
lin = lin + 1
Loop
Close #1
End Sub
