Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Copy Two Columns of Flat File to Final Excel File

SUMMARIZED QUESTIONS
How to copy a specified/certain columns of a flat file (.csv) to a Final
Workbook without having to copy all data in the flat file at once?

DETAILED:
What I essentially need to accomplish is to copy a few columns of a flat
file (Report.csv) to a €śFinal file€ť, I dont need all of the data in the flat
file. I dont think there is a €śdirect way€ť to get this done, so heres what
Im thinking of doing it:

There are three files involve in this. One is the .csv file that need to be
imported to a Temp file, and the third file is the Final file that I need to
copy only 2-3 columns the Temp file to it.

Obviously, I dont want to save the Temp file since it would be too much to
keep track of once there are too many files in the process. Since thats the
case, here is how I create my Macro: I open a new book (Workbook#) then run
the Transfer Data wizard to get the .csv file to that workbook. The problem
is Workbook# always change according to how many workbook the user open
previously to run this Macro, so the code: €śWindows("Workbook2").Activate€ť
doesnt work if workbook name is €śWorkbook[other number]. Any solution to
this?

With the understanding that dataset can change from time to time, can anyone
help me modify the code so that it will look for the last row to copy all
data instead of the set range that I gave it when I record the Macro?

Note that this flat file has no header row.

Thank you,
Neon520


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Copy Two Columns of Flat File to Final Excel File

Hi,

Have you tried doing this with a Data Import? If the CSV file name and
location is always the same then this would be your best option. You should
be able to select the columns you wish to import, and then all you would need
to do is refresh the data range each time. If, however, you wanted to run it
as a macro instead of refreshing the workbook each time and saving as a new
filename, you could import the data and record that as a macro.

There are options to do what you are looking for, but they would be a lot
more lengthy than using a Data import.

Sean.
--
(please remember to click yes if replies you receive are helpful to you)


"Neon520" wrote:

SUMMARIZED QUESTIONS
How to copy a specified/certain columns of a flat file (.csv) to a Final
Workbook without having to copy all data in the flat file at once?

DETAILED:
What I essentially need to accomplish is to copy a few columns of a flat
file (Report.csv) to a €śFinal file€ť, I dont need all of the data in the flat
file. I dont think there is a €śdirect way€ť to get this done, so heres what
Im thinking of doing it:

There are three files involve in this. One is the .csv file that need to be
imported to a Temp file, and the third file is the Final file that I need to
copy only 2-3 columns the Temp file to it.

Obviously, I dont want to save the Temp file since it would be too much to
keep track of once there are too many files in the process. Since thats the
case, here is how I create my Macro: I open a new book (Workbook#) then run
the Transfer Data wizard to get the .csv file to that workbook. The problem
is Workbook# always change according to how many workbook the user open
previously to run this Macro, so the code: €śWindows("Workbook2").Activate€ť
doesnt work if workbook name is €śWorkbook[other number]. Any solution to
this?

With the understanding that dataset can change from time to time, can anyone
help me modify the code so that it will look for the last row to copy all
data instead of the set range that I gave it when I record the Macro?

Note that this flat file has no header row.

Thank you,
Neon520


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a flat file in Excel GF08 Excel Discussion (Misc queries) 4 November 19th 09 05:10 PM
how do I convert an excel file to a flat text file Lannutslp Excel Discussion (Misc queries) 1 June 3rd 05 10:17 AM
Convert excel file to flat text file Lannutslp Excel Discussion (Misc queries) 1 June 1st 05 03:48 AM
Convert excel file to flat text file Gary's Student Excel Discussion (Misc queries) 0 June 1st 05 12:17 AM
write out a flat file with fixed columns Steve[_35_] Excel Programming 3 August 29th 03 09:04 PM


All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"