View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
frank frank is offline
external usenet poster
 
Posts: 1
Default Macro to generate txt files using Excel

Mr. Yetton

Thank you so much for your reply!
I cordially appreciate your help.

There was a small problem.

The code that I am attaching below compiles
[I replaced the line
"Sheets("Input2").Select" by
"Sheets("Sheet2").Select"]

It works - it creates new files that are based on
Sheet2. However, these files are evaluated at the
values of all 4 parameters = 0.

It seems that the code below takes a value in say
cell C2 of Sheet3 and pastes it into cell C2 of
Sheet1. However the Excel formulas on Sheet2 all
depend on cells A1:A4. The values in Sheet2 would
get recalculated if we were to paste
cell C2 from Sheet3 Into cell A3 [i.e., we need to
transpose each row [that has 4 columns] on Sheet3 and
paste these 4 values into cells A1:A4.

Mr. Yetton, may I please ask for your help again?

Best Regards

Frank

P.S.

The code that compiles:

Sub test()
Sheets("Sheet2").Select
For y = 1 To 3
Application.Calculation = xlManual
For x = 1 To 4
Sheets("Sheet1").Cells(x, y) = Sheets
("Sheet3").Cells(y, x)
Next
Application.Calculation = xlAutomatic
Filename = "C:\source\" & y & ".txt"
ActiveWorkbook.SaveAs _
Filename:=Filename, _
FileFormat:=xlText, CreateBackup:=False
Next
End Sub