Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a long string of data in a text document that I want to enter into an
Excel document. I also want to insert a space after every three characters. For example, AGCTGCCAAGTC gets changed to this : AGC TGC CAA GTC, and each of these triplets is in separate columns |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need more information
where do you want to add the data into excel? Do you want each lint in the text file in a seperate row of the worksheet all in column A? Then add the spaces to the cell? Or do you wantt each set of 3 characters in a different column? Be careful, there is a limit to the number of characters you can put in each cell. I thinik its 256 characters. "Sam" wrote: I have a long string of data in a text document that I want to enter into an Excel document. I also want to insert a space after every three characters. For example, AGCTGCCAAGTC gets changed to this : AGC TGC CAA GTC, and each of these triplets is in separate columns |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Wow thanks for responding so quickly. Well I want to sort the data (I have
other info that I want to add once I can figure out this part), and I want each set of 3 characters to head its own column. "Joel" wrote: I need more information where do you want to add the data into excel? Do you want each lint in the text file in a seperate row of the worksheet all in column A? Then add the spaces to the cell? Or do you wantt each set of 3 characters in a different column? Be careful, there is a limit to the number of characters you can put in each cell. I thinik its 256 characters. "Sam" wrote: I have a long string of data in a text document that I want to enter into an Excel document. I also want to insert a space after every three characters. For example, AGCTGCCAAGTC gets changed to this : AGC TGC CAA GTC, and each of these triplets is in separate columns |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub read_test2()
Const ForReading = 1, ForWriting = 2, ForAppending = 3 fileToOpen = Application.GetOpenFilename("Text Files (*.txt), *.txt") Dim fs, f Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.OpenTextFile(fileToOpen, ForReading) RowCount = 1 Do While f.AtEndOfStream < True line1 = f.readline char_count = 3 column_off = 0 Do While Len(line1) 2 three_char = Left(line1, 3) Cells(1, "A").Offset(rowOffset:=0, columnOffset:=column_off).Value = _ three_char line1 = Mid(line1, 4) column_off = column_off + 1 Loop Loop End Sub "Sam" wrote: Wow thanks for responding so quickly. Well I want to sort the data (I have other info that I want to add once I can figure out this part), and I want each set of 3 characters to head its own column. "Joel" wrote: I need more information where do you want to add the data into excel? Do you want each lint in the text file in a seperate row of the worksheet all in column A? Then add the spaces to the cell? Or do you wantt each set of 3 characters in a different column? Be careful, there is a limit to the number of characters you can put in each cell. I thinik its 256 characters. "Sam" wrote: I have a long string of data in a text document that I want to enter into an Excel document. I also want to insert a space after every three characters. For example, AGCTGCCAAGTC gets changed to this : AGC TGC CAA GTC, and each of these triplets is in separate columns |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
bring in your data. Select the single column and do Data=Text to columns
Select fixed and in the next page of the dialog, click between every 3rd and 4th character. then continue on. Turn on the macro recorder before you do this if you want code. -- Regards, Tom Ogilvy "Sam" wrote: I have a long string of data in a text document that I want to enter into an Excel document. I also want to insert a space after every three characters. For example, AGCTGCCAAGTC gets changed to this : AGC TGC CAA GTC, and each of these triplets is in separate columns |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return cell characters after space | Excel Worksheet Functions | |||
Put A Space Between 2 right characters | Excel Worksheet Functions | |||
cHARACTERS BEFORE THE SPACE | Excel Worksheet Functions | |||
Characters before the space | Excel Programming | |||
erase all space characters into string | Excel Programming |