ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Any help is appreciated Creating New files from One File (https://www.excelbanter.com/excel-programming/413174-any-help-appreciated-creating-new-files-one-file.html)

JackSmiley

Any help is appreciated Creating New files from One File
 
I have a file that i have added a control that allows the user to
change criteria and recalculate the worksheet. I have developed the
code that loops through all the scenarios I enter and prints each one.

What I really want to do is loop through these scenarios and then
instead of printing, create a new separate file, then keep moving
through the loop and creating new files

Thanks in advance

joel

Any help is appreciated Creating New files from One File
 
try this

from
for RowCount = 1 to 10
Rows(RowCount).Printout
next RowCount

to
set Oldsht = activeworkbook.activesheet
for RowCount = 1 to 10
set newbk = Workbooks.add
Oldsht.Rows(RowCount).Copy _
Destination:=newbk.Rows(1)
newbk.saveas filename:="abc"&RowCount&".xls"
activeworkbook.close
next RowCount


"JackSmiley" wrote:

I have a file that i have added a control that allows the user to
change criteria and recalculate the worksheet. I have developed the
code that loops through all the scenarios I enter and prints each one.

What I really want to do is loop through these scenarios and then
instead of printing, create a new separate file, then keep moving
through the loop and creating new files

Thanks in advance



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

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