Importing CSV Files from a folder

Kentucky_User

New Member
Joined
Feb 11, 2015
Messages
3
Hi Everyone,

I am trying to create a macro that will allow me to selected multiple CSV files in a folder to import into an EXCEL spreadsheet. The CSV files are already in an EXCEL worksheet after being downloaded from another database. There are four columns of data in each file that I want to import.

What would be the best way to approach this problem? I was thinking about parsing the data from each file but I was wondering if I could just convert the files into EXCEL files and then copy and paste the values I need. Would that approach work?

Thank you!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Stadem

New Member
Joined
Jan 8, 2015
Messages
35
Yes, that approach should work.

Code:
Dim wbCSV1 As Workbook
Dim ws As Worksheet
Application.Workbooks.OpenText Filename:="C:\CSV Files\MyFavoriteCSV.csv", DataType:=xlDelimited, Comma:=True
Set wbCSV1 = ActiveWorkbook
Set ws = wbCSV1.Sheets(1)
 
Upvote 0

Forum statistics

Threads
1,187,095
Messages
5,961,558
Members
438,553
Latest member
jwmoorear

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top