Importing data for CSV into Excel using VBA

B

Basu

Hello to all,

I have a question regarding CVS import. I need to do two tasks. First I
need to select a range in a worksheet (could be 4 rows by 4 cols or
more) and then create a CSV file with this range. I have about 30 such
kinds of files. So I create 30 CSV files.

Then what I need to do is, then import this data into another main
excel sheet. I will need to put the rows/cols where to put the data.

Hence I need two answers actually. The first would be to create the CSV
file from the excel sheet (selected range) and then the second solution
required to get the data back into another excel sheet.

Any help, pointers and directions will be highly appreciated.

Regds
 
J

Jon Peltier

1. Copy the range to be exported to a new workbook, starting in A1. Save
this workbook as a CSV file.

2. Open the CSV file using Workbooks("filename.csv").Open, then copy the
used range of the newly opened file and paste it into the appropriate range
in the target worksheet.

- Jon
 
B

Basu

Hi Jon,

Thank you for your response.

That would be a good place to start. Do you have any code that can
accomplish this? That would greatly help me get started.

Look forward to your response.

Regds
Shuvro
 

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