ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Two Columns of Flat File to Final Excel File (https://www.excelbanter.com/excel-programming/423736-copy-two-columns-flat-file-final-excel-file.html)

Neon520

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




All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com