How to Extract Data from a CSV file???

H

hce

I need help on how to write a VB command that will allow me to extract
data from a specified column in a CSV file. I have written a command in
VB to extract all data from the CSV file and paste it on an excel
worksheet. This method is working fine but because the file is too big,
it takes a long time for me to extract everything. I only need the data
from one column so if anyone out there can help me with this, I would
be extremely grateful...

Cheers
 
B

bdcrisp

open "c:\whatever.csv" for input as #1
counter =1
Do while not EOF(1)
input #1, col1,col2 ... ,colInterest,(etc)

' input all columns, but only use the one u 'want -- make sure and add
a variable 'representing every col

'displaypage - whatever page you want to 'display to

displaypage.cells(counter,1).value = colInterest : counter = counter +
1

Loop
CLOSE #1
displaypage.activate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top