1
votes

I want to read out a semicolon (;) delimited *.csv file in an Excel sheet with the help of a macro (Visual Basic).

I don't need all data from the *.csv file; I only need three defined columns of it. These three columns should be imported in defined columns of the target Excel sheet.

Any suggestion?

1
The easiest way would be to import all of it and then copy the concerned columns over to where you want them. Use the macro recorder to learn how to do this. - Jon49
Is this a VBA or VBscript question? - brettdj

1 Answers

1
votes

There are two steps for this tasks:

  1. Loop through all .csv files in your file http://www.ozgrid.com/VBA/loop-through.htm

  2. Look through all spreadsheets in each workbook

    Dim ws as Worksheet
    Set ws = wb.Worksheets(1) ' Set wb = Workbooks.Open( Your files ) in step 1
    ' Copy columns here
    

Finished