Row text to columns

J

jaycee.lions

I have a text file with data in the following format.

Name = Assembler
Code = 10.0
Release = 14.2.2003
Name = Assembler
Code = 11.0
Release = 14.2.2009

I want to present in excel sheet in columns
Name Code Release

I tried importing the file and using the text-2-col function in the data tab. it did not work - it put all the data in Col A

Any suggestions? or help will be appreciated - since there is around 400K records
 
I

isabelle

hi Jaycee,

Sub Macro1()
Dim LastRow As Long, rw As Long, i As Long, y As Integer
rw = 1
With Sheets("Sheet2")
.Cells(1, 1) = "Name"
.Cells(1, 2) = "Code"
.Cells(1, 3) = "Release"
End With

With Sheets("Sheet1")
LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
For i = 1 To LastRow Step 3
rw = rw + 1
For y = 1 To 3
Sheets("Sheet2").Cells(rw, y) = .Cells(y, 2)
Next
Next
End With
End Sub

isabelle


Le 2013-01-25 11:45, (e-mail address removed) a écrit :
 
I

isabelle

correction:

Sub Macro1()
Dim LastRow As Long, rw As Long, i As Long
rw = 1
With Sheets("Sheet2")
.Cells(1, 1) = "Name"
.Cells(1, 2) = "Code"
.Cells(1, 3) = "Release"
End With

With Sheets("Sheet1")
LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
For i = 1 To LastRow Step 3
rw = rw + 1
Sheets("Sheet2").Cells(rw, 1) = .Cells(i, 2)
Sheets("Sheet2").Cells(rw, 2) = .Cells(i + 1, 2)
Sheets("Sheet2").Cells(rw, 3) = .Cells(i + 2, 2)
Next
End With
End Sub

isabelle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top