Hey guys. I am trying to write .txt into excel using VBA.
This is something I got from the internet. I've attached the text file.
I am trying to select the first couple of lines which has quotation around them. What can I do to select the lines with quotation and remove them. At the same time, leaving the numeric data lines written on excel.
Thank you.
Public Sub textToexcel()
Dim FilePath As String
Dim strLine As String
Dim i As Integer
Dim lines As Collection
Set lines = New Collection
FilePath = "C:\Users\Deepsheit\Desktop\School\lab 5\singleSpecimen.txt"
Open FilePath For Input As #1
If Err <> 0 Then
MsgBox "Not found: " & Filename, vbCritical, "ERROR-GDS"
Exit Sub
End If
i = 1
While EOF(1) = False
Line Input #1, strLine
Cells(i, 1) = strLine
i = i + 1
Wend
End Sub
Bookmarks