|
▼まい さん:
こんな方法もあります。
Sub txt取込()
Dim i As Integer
Dim j As Integer
Dim Mytxt As String
Dim Mystr As String
Dim MyRange As Range
Dim TmpRange As Range
Dim FileName As String
Dim myPath As String
Dim strDir As String
Dim V As Variant
Dim sht As Worksheet
Set sht = Worksheets.Add(before:=Worksheets(1))
sht.Name = "txtData"
strDir = "C:\Temp\"
Mytxt = Dir(strDir & "*BS.txt")
i = 1
Do While Mytxt <> ""
Open strDir & Mytxt For Input As #1
Do Until EOF(1)
Line Input #1, Mystr
V = Split(Mystr, ",")
sht.Cells(i, 1).Resize(, UBound(V) + 1).Value = V
i = i + 1
Loop
Close #1
Mytxt = Dir
Loop
End Sub
|
|