MWheeelerFDWT,
Give the following a try:
Sub ReadTextFile2()
Dim sPath As String: sPath = Application.GetOpenFilename("Text Files, *.txt")
If sPath = "False" Then Exit Sub
Dim sLine As String, aData() As Variant, DataIndex As Long
Open sPath For Input As #1
While Not EOF(1)
DataIndex = DataIndex + 1
Line Input #1, sLine
If Trim(sLine) = vbNullString Then
DataIndex = DataIndex - 1
Else
ReDim Preserve aData(0 To 5, 1 To DataIndex)
aData(0, DataIndex) = Trim(Split(sLine, ",")(0))
aData(1, DataIndex) = Trim(Split(sLine, ",")(1))
aData(2, DataIndex) = Trim(Split(sLine, ",")(2))
aData(3, DataIndex) = Trim(Split(sLine, ",")(3))
aData(4, DataIndex) = Trim(Split(sLine, ",")(4))
aData(5, DataIndex) = Trim(Split(sLine, ",")(5))
End If
Wend
Close #1
If DataIndex > 0 Then [A3].Resize(DataIndex, 6).Value = WorksheetFunction.Transpose(aData)
End Sub
Hope that helps,
~tigeravatar
Bookmarks