LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to insert values from a file and save another sheet as a .txt file

Hello All,

Thanks in advance for reading.

I have two input files: MainInput.xls and ParCombos.txt.

ParCombos.txt is a tab delimited text file that has 4 columns.
Each row in this document contains a combination of 4 parameters.

MainInput.xls is an Excel file that has 2 worksheets. On the first
sheet there are many columns with data and formulas. All of the
values being calculated on this sheet, depend on 4 cells:
A1, A2, A3, A4. The second sheet has many columns with formulas.
These formulas depend on the values that were calculated on Sheet 1.

I desperately need to write a macro to do the steps below, but I
don't know where to start. The steps a

1. Open ParCombos.txt, and copy the values in the 1st row.
2. paste the value from the 1st column of ParCombos.txt
into A1 of Sheet 1 of MainInput.xls

paste the value from the 2nd column of ParCombos.txt
into A2 of Sheet 1 of MainInput.xls

paste the value from the 3rd column of ParCombos.txt
into A3 of Sheet 1 of MainInput.xls

paste the value from the 4th column of ParCombos.txt
into A4 of Sheet 1 of MainInput.xls

3. Wait for the values in both sheets 1 and 2 in Maininput.xls
to be recalculated [This MainInput.txt file is a 40Mb file].

4. Go to Sheet 2 of Maininput.xls and Save it [only Sheet 2]
as Maininput1.txt [in some/any directory]. Save it as a Tab delimited
text file.

5. Repeat steps 1-5 for the values of the 2nd row of ParCombos.txt.
Keep repeating steps 1-5 until we run out of rows in ParCombos.txt

Thus, if ParCombos.txt has X rows, then the output of this macro would
be X tab delimited files named Maininput1.txt, MainInput2.txt, ...,
MainInputx.txt

Any help would be appreciated.

Many Thanks


Frank

 
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
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
Can you save 1 sheet from a large file into another file? imktew Excel Worksheet Functions 2 January 17th 08 05:46 AM
how do I get a macro to save a sheet and set the file name? MadasMax Excel Discussion (Misc queries) 1 September 16th 07 12:04 PM
copy the same raws of all sheets from about a 100 file to a new sheet of a book and save the file [email protected] Setting up and Configuration of Excel 0 March 14th 07 02:13 AM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


All times are GMT +1. The time now is 03:06 AM.

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

About Us

"It's about Microsoft Excel"