Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
parsing data - formatting issue terri Excel Discussion (Misc queries) 11 March 6th 06 03:43 PM
VBA Import of text file & Array parsing of that data Dennis Excel Discussion (Misc queries) 4 November 28th 04 10:20 PM
Parsing imported text file with macro... help! scrupul0us[_2_] Excel Programming 0 September 7th 04 10:13 PM
Excel vb running a batch files and parsing output issue Mike S[_3_] Excel Programming 0 June 8th 04 04:43 AM
parsing text file, and generating distinct cell values gerridge Excel Programming 0 April 8th 04 01:46 AM


All times are GMT +1. The time now is 10:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"