Please Help

Bassai

New Member
Joined
Sep 3, 2012
Messages
6
Hi

I need to move data from 5 rows in one column and to separate columns. The data looks like this

Infinity Auto Import
20 Puriri Street, New Lynn, Auckland
09 9512882
View dealer listings
IV Cars
90 Portage Road, Otahuhu, Auckland
09 9512843
But needs to be sorted like this:
Column AColumn BColumn C
Infinity Auto Import20 Puriri Street, New Lynn, Auckland09 9512882
IV Cars90 Portage Road, Otahuhu, Auckland09 9512843
I would appreciate your help

<colgroup><col><col><col></colgroup><tbody>
</tbody>
 

ranman256

Well-known Member
Joined
Jun 17, 2014
Messages
1,820
adjust as needed...

Rich (BB code):
Sub ParseFile()
Dim vFile, vLine
Dim i As Integer
Const Q = """"
vFile = "C:\temp\textfile.txt"
Range("a2").Select
i = 1
Open vFile For Input As #1 
While Not EOF(1)
  Line Input #1 , vLine
  vLine = Trim(vLine)
  
  If InStr(vLine, "View dealer listings") > 0 Then vLine = ""
  
    If vLine <> "" Then
        ActiveCell.Offset(0, i - 1).Value = vLine
        
        i = i + 1
        If i = 4 Then
          i = 1
          ActiveCell.Offset(1, 0).Select  'next row
        End If
    End If
Wend
Close 1
End Sub
 

Forum statistics

Threads
1,085,952
Messages
5,386,915
Members
402,025
Latest member
saresum

Some videos you may like

This Week's Hot Topics

Top