I have coded this so far:
Sub FileName()
' Open file and place content into worksheet.
Dim dlgOpen As FileDialog
Dim fields As String, FileName As String, target As String
Dim fileHandle As Integer
Dim i As Long, j As Long
Set dlgOpen = Application.FileDialog(msoFileDialogOpen)
With dlgOpen
'we want just the one file
.AllowMultiSelect = False
.Show
For i = 1 To .SelectedItems.Count
FileName = .SelectedItems(i)
Next
End With
'get counter ready
j = 0
'prepare the file handle
fileHandle = FreeFile()
Open FileName For Input As fileHandle
Do Until EOF(fileHandle)
Line Input #fileHandle, fields
Range("A1").Offset(j, 0).Value = fields
j = j + 1
Loop
Close #1
End Sub
Once the file is inputted into the excel sheet it all goes into column A. I want to use vba to separate each column the end results should have column A and B filled. Attach is the file I used to open and wanting to parse.
Bookmarks