PDA

View Full Version : [SOLVED:] Repeat Procedure



ericb1988
06-08-2014, 11:24 AM
I am looking for a loop to repeat a procedure 1000 times. Here's the procedure:


ChDir "C:\Users\Eric2\Desktop\playbook_7500\Cost1"
Workbooks.Open Sheets("sheet1").Range("A1").Value
Call callcomplete
Call callcopycolumns
Windows("copynumbers1.xlsx").Activate
Call callfinished1
Cells(Selection.Row, Columns.Count).End(xlToLeft).Offset(, 1).Select
ActiveSheet.Paste
Windows("opens workbook based on cell value.xlsm").Activate


thanks for any help.

Bob Phillips
06-08-2014, 11:54 AM
You want to open the same workbook 1000 times?

ericb1988
06-08-2014, 12:10 PM
Thanks for the reply. I have code that will close each workbook after it does a specific task.

ashleyuk1984
06-08-2014, 03:39 PM
For x = 1 To 1000

ChDir "C:\Users\Eric2\Desktop\playbook_7500\Cost1"
Workbooks.Open Sheets("sheet1").Range("A1").Value
Call callcomplete
Call callcopycolumns
Windows("copynumbers1.xlsx").Activate
Call callfinished1
Cells(Selection.Row, Columns.Count).End(xlToLeft).Offset(, 1).Select
ActiveSheet.Paste
Windows("opens workbook based on cell value.xlsm").Activate

Next x


??

westconn1
06-08-2014, 04:59 PM
I have code that will close each workbook after it does a specific task.so there is a list of workbooks somewhere?

ericb1988
06-08-2014, 09:59 PM
Your code work great. Thanks

Bob Phillips
06-09-2014, 12:35 AM
That looks like opening the same workbook 1000 ties to me.