Consulting

Results 1 to 7 of 7

Thread: Repeat Procedure

  1. #1

    Repeat Procedure

    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.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master xld's Avatar
    Joined
    Apr 2005
    Posts
    25,082
    Location
    You want to open the same workbook 1000 times?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Thanks for the reply. I have code that will close each workbook after it does a specific task.

  4. #4
    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
    ??

  5. #5
    I have code that will close each workbook after it does a specific task.
    so there is a list of workbooks somewhere?

  6. #6
    Your code work great. Thanks

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master xld's Avatar
    Joined
    Apr 2005
    Posts
    25,082
    Location
    That looks like opening the same workbook 1000 ties to me.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •