Results 1 to 3 of 3

Thread: [RESOLVED] Opening Multiple files

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    9

    Resolved [RESOLVED] Opening Multiple files

    I am trying to write a macro in Excel to copy data from a same cell in several different spreadsheets. All of the spreadsheets are located in the same folder in my computer. The spreadsheets are named 2006-00001, 2006-00002, 2006-00003, ...., 2006-99999. To complete this task, I am trying to do a loop to open each spreadsheet:

    For i=1 to i=9:
    Workbooks.Open Filename:= _
    "\\brasms115\wwreports\In Process\2006\2006-0000" i ".XLS", UpdateLinks:=0

    For i=10 to i=99:
    Workbooks.Open Filename:= _
    "\\brasms115\wwreports\In Process\2006\2006-000" i ".XLS", UpdateLinks:=0

    etc...

    However, I am getting the following error with reference to the i:
    Compile error:
    Expected: end of statement

    Does anyone know the proper way to do this?
    Any and all help much appreciated!

    Thank you,
    Ed

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Opening Multiple files

    .....2006\2006-000" & i & ".XLS",

    you need the & symbol in there...
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Opening Multiple files



    Please use [vbcode] your code goes in here [/vbcode] tags when posting code.

    When you have received an answer to your question, please mark it as Resolved using the Thread Tools menu.
    CS

Posting Permissions

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



Click Here to Expand Forum to Full Width