PDA

View Full Version : Solved: Import Text problem



Dreamer
04-27-2006, 10:20 PM
Hi all,

I want to import text file to excel, and I've got a problem ...

I've used "\" as the delimiter, but this will cause the problem for the following lines:
H \ 1 \ yes
I \ 2 \ no
J \ 3 \ no
K \ 4 \ no
N \ 7 \ yes \ no
O \ 8 \ HGK \ GHG

Indeed "yes \ no" & "HGK \ GHG" should be put together, if I divide it by "\", they will be seperated.

N 7 yes no
O 8 HGK GHG

If I only take the first 2 "\" into account, can I use macro to help this? Thanks!!

Desired Output:
H 1 Yes
I 2 No
J 3 no
K 4 no
N 7 yes \ no
O 8 HGK \ GHG

geekgirlau
04-27-2006, 10:29 PM
Can I ask why \ is the delimiter? Do you have the option to change it to something else?

Dreamer
04-27-2006, 11:22 PM
Hi, because the original text file contains "\" and I can't change that.. I have no clue to solve it....

jindon
04-27-2006, 11:28 PM
How are you importing?

you can set the max splits with split function like
if string is like

O \ 8 \ HGK \ GHG

split(string,"\",3)

will give you O 8 HGK\CHG