Text file into Excel VBA empty line new column -


i have sheets of data in txt files single column. need import excel , break each field break new columns @ empty line. not sure if best in import or after import.

foobar detail1 detail2 val1 val2 val3 val4 randominfo  widget detail1 detail2 val1 val2 val3 val4 randominfo 

you'll want read file in line line , move on when read empty line.

edit: forgot answer question...just on import. other way makes scan list again , not efficient.

dim r integer dim c integer  ''initialize r = 2 c = 1  ''i'm assuming have row headers or row starts @ two. ''change 1 if want data in first row.  open [your file path here] input #1 until eof(1)      line input #1, readline      if readline = ""         'index on 1 column         'start row indexer on         c = c + 1         r = 2       else         'output "readline" sheet         activesheet.cells(r, c).value = readline         'index down 1 row         r = r + 1      end if   loop  close #1 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -