Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy data from .txt to .xls
Problem:I have a .txt which contains 100 rows (each row is only one
word or number). I managed to copy all 100 values into .xls (all 100 data in one column).but i need to split those 100 values into 5 colums (each column would contain 20 values). like this: .txt 1 2 3 4 5 6 .. .. .. 100 ..xls would look like this: 1 21 41 2 22 42 3 23 . 4 . . .. . . .. . . 20 40 60 and so on, till 100. please could somebody help me |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy data from .txt to .xls
Well, you can easily do that with your mouse, but since you are posting
in a "programming" news group, I assume you need a VBA solution. Here is one, but it is untested. This will copy original data from column A to columns B ... F ---------------------------------------- public sub Copy_alll dim s As Excel.Worksheet set s = activesheet call Copy_Section (s, 1, 20, "B") call Copy_Section (s, 21, 40, "C") call Copy_Section (s, 41, 60, "D") call Copy_Section (s, 61, 80, "E") call Copy_Section (s, 81, 100, "F") end sub private sub Copy_Section (s as Excel.Worksheet, fRow as Long, lRow as long, Col as String) dim x as long dim r as long x = 0 for r = fRow to lRow x = x + 1 s.Cells (x, Col).value = s.Cells (r, "A").value next r end sub rea wrote: Problem:I have a .txt which contains 100 rows (each row is only one word or number). I managed to copy all 100 values into .xls (all 100 data in one column).but i need to split those 100 values into 5 colums (each column would contain 20 values). like this: .txt 1 2 3 4 5 6 . . . 100 .xls would look like this: 1 21 41 2 22 42 3 23 . 4 . . . . . . . . 20 40 60 and so on, till 100. please could somebody help me |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy data from .txt to .xls
thnx, i will try it and let you know does it works!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
filted data, copy and paste a col. puts data in wrong row how fix | New Users to Excel | |||
Retrieve multiple data rows data from a very long list and copy t | Excel Discussion (Misc queries) | |||
How do I copy data from main frame computer and keep data in cell | Excel Worksheet Functions | |||
Copy old Data from web query while keeping previous days data | Excel Worksheet Functions | |||
Copy data into cells until changes trigger new copy | Excel Programming |