mikensu12
asked on
cvs and space
Got a file that I want to separate and put in columns. Look
like some of the fields in file are separated by spaces and other by tabs. I want to format so the the name and address and etc are separated in columns.strStarter = "RT 29 MONTPELIER VA 23100 23100"
intStarter = Len(strStarter)
For i = intStarter to 2 Step -1
strChars = Space(i)
strStarter = Replace(strStarter, strChars, " ")
strStarter1 = Replace(strStarter, vbTab, " " )
Next
arrStarter = Split(strStarter, " ")
arrStarter2= Split(strStarter1,vbTab)
For Each strUnit in arrStarter
Wscript.Echo strUnit
Next
For Each strUnit2 in arrStarter2
Wscript.Echo strUnit2
Next
Test-Data.txt
What do you want the output to look like, maybe this?
RT 29,MONTPELIER VA 23100,23100
RT 50,MONTPELIER VA 23100,23100
DOE JOHN,2100 BOODROW AVE,RICHMOND VA 21000,23222
~bp
ASKER
TalShyar,
This has to be automated
billprew, the output below
DOE JOHN,RT 29,MONTPELIER VA 23100,23100
RT 50,MONTPELIER VA 23100,23100
2100 BOODROW AVE,RICHMOND VA 21000,23222
This has to be automated
billprew, the output below
DOE JOHN,RT 29,MONTPELIER VA 23100,23100
RT 50,MONTPELIER VA 23100,23100
2100 BOODROW AVE,RICHMOND VA 21000,23222
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for mikensu12's comment #a39346694
for the following reason:
good
Accepted answer: 0 points for mikensu12's comment #a39346694
for the following reason:
good
1. Open MS Excel
2. Click on File | Open and point to the txt file
3. Select "delimited" on page 1 and hit Next
4. Select "TAB" and "SPACE" and hit Next
5. Set page 3 as default or change as needed
6. Hit finish and you are done.
Hell a lot faster than scripting it. If you need it in a script, let me which type and what language.