Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import CSV file into Excel

Status
Not open for further replies.

jvanderw

Technical User
Aug 13, 2003
28
US
Hey all,
I need to import a CSV file located at "C:\Temp\Results.txt" into the "Results" tab of an excel file located at "C:\Simulation\28DayInputs.xls". I need to use VBA (due to the requirement of software called Simul8) but have a very limited knowledge of VBA. Any help that you can provide will be greatly appreciated.
Thanks,
Josh
 
A good starting point is to play with the Macro recorder.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for the tip. I tried the macro recorder and am able to get the code to open a text file in a new workbook:
Workbooks.OpenText FileName:="C:\Temp\RESULTS.TXT", Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=True, _
Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2), Array(2, 1), Array( _
3, 1), Array(4, 1), Array(5, 1), Array(6, 1))

However, I need to be able to import the info directly into a specific tab of an existing file and don't see any parameters that can be used to do this.
Any more thougts?
Thanks,
Josh
 
Open the file as you are doing, select all cells with data and then paste into the destination sheet. This can be created, but on this case it is easier to copy the whole worksheet.

Search these forums for copy and paste and you will also find some examples.

And offcourse that the macro recorder can also help on this case.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top