excel - Reading data from text file and delimiting -


i have excel 2010 spreadsheet, , reading in information .txt file (and .xls file in future).

this text file has 3 elements per row; firtname, surname , job title, , each element separated comma. have data reading , pasting excel, each row pasted 1 cell. looking paste each element different columns. know should try , delimit, can't figure out syntax.

my question how separate each element , paste it's own cell? use commas separate each element on .txt file, future files might use tabs, full-stops, semi-colons etc. how extend bases covered?

below code, , under code sample of dummy data

sub fetchdatafromtextfile()     dim long     dim linetext string     open "c:\mytxtfile.txt" input #24     = 2     while not eof(24)         line input #24, linetext         activesheet.cells(i, 2).value = linetext         p = split(record, ",")         = + 1     wend     close #24 end sub 

john, doe, boss

johnny, steele, manager

jane, smith, employee

note: competant in other programming languages, not done vb in 6 or 7 years. can never seem wrap head around vb syntax, please treat me novice this.

sub fetchdatafromtextfile()     dim long     dim linetext string     open "c:\mytxtfile.txt" input #24     = 2     while not eof(24)         line input #24, linetext             dim arr             arr = split(cstr(linetext), ", ")             j = 1                  activesheet.cells(i, j).value = arr(j - 1)             next j             = + 1     wend     close #24 end sub 

for different delimiters, make use of answers in here


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -