Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Issue with parsing text file into worksheet
Hello, I have a sub function that goes to a shared drive to grasp a text file, open it and parse it into a worksheet using Delimited. After that, I call a macro that uses "TextToColumns" to parse the column of cells from that worksheet into several columns using FixedWidth. I noticed that the first few digits of some numbers were cut off and put into next cells. To fix it, I went to my codes and manually changed character widths for the columns (arrays below) and it worked for that day. However, the next day, when a new text file comes, the numbers are cutt off again. Is there any way to fix this problem? It’s not efficient to manually change code everyday. I apreciate any idea/help. Thanks! Here is my code. Range("A" & RowNumber & ":A" & RowNumber + 1000).Select Selection.TextToColumns Destination:=Range("A" & RowNumber & ":A" & RowNumber + 400), DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array(11, 1), Array(24, 1), Array(34, 1), Array(50, 1), Array(65, 1), Array(79, 1), Array(93, 1), Array(105, 1), Array(119, 1), Array(132, 1), Array(147, 1), Array(161, 1), Array(175, 1), Array(187, 1), Array(202, 1), Array(215, 1), Array(230, 1), Array(244, 1), Array(257, 1), Array(270, 1)), TrailingMinusNumbers:= True -- primrose ------------------------------------------------------------------------ primrose's Profile: http://www.excelforum.com/member.php...o&userid=23716 View this thread: http://www.excelforum.com/showthread...hreadid=373898 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Issue with parsing text file into worksheet
what type of data is it. I think fixed width is not a correct option for using text to columns. for fixedwidth all the rows should have same width between fields. can you paste or attach sample content. -- anilsolipuram ------------------------------------------------------------------------ anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271 View this thread: http://www.excelforum.com/showthread...hreadid=373898 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
parsing data - formatting issue | Excel Discussion (Misc queries) | |||
VBA Import of text file & Array parsing of that data | Excel Discussion (Misc queries) | |||
Parsing imported text file with macro... help! | Excel Programming | |||
Excel vb running a batch files and parsing output issue | Excel Programming | |||
parsing text file, and generating distinct cell values | Excel Programming |