+ Reply to Thread
Results 1 to 2 of 2

Macro for multiple open files

  1. #1

    Macro for multiple open files

    I am trying to automate a process where I have multiple Excel 'data'
    files open and want to take each file individually and add that file to
    a 'report' workbook where a series of macros run, and then name, save
    and close the newly created file, and moves on to the next open 'data'
    file, and the original static workbook remains open. This is all in a
    'Do Until' or 'Do While' format so upon completion of the main macro I
    end up with multiple 'finished' reports.

    I'm struggling at the beginning and end of this process. I don't know
    the code that copies an activesheet to an existing 'report' file and
    then saves and closes the newly created file such that the original
    'report file' remains open and ready to use for the next open 'data'
    file.

    I greatly appreciate any direction you have...

    Thank you,

    Tony


  2. #2
    exceluserforeman
    Guest

    RE: Macro for multiple open files

    Sub MultiPlanStyle()
    dim strReportBook as string
    dim i as integer
    ' If the Source workbooks are already open and the Target ie Reprt book is
    also 'open
    strReportBook="ReportBook.xls"
    for i=1 to workbooks.count
    workbooks(i).activate
    if workbooks(i).name=strReprtbook then
    else
    sheets(1).select
    cells.select
    workbooks(strReportBook).activate
    sheets(1).select
    cells.clear
    range("a1").select
    activesheet.paste
    application.cutcopymode=False

    Call MainMacro

    activeworkbook.save
    workbooks(i).activate
    end if
    next


    end sub

    "[email protected]" wrote:

    > I am trying to automate a process where I have multiple Excel 'data'
    > files open and want to take each file individually and add that file to
    > a 'report' workbook where a series of macros run, and then name, save
    > and close the newly created file, and moves on to the next open 'data'
    > file, and the original static workbook remains open. This is all in a
    > 'Do Until' or 'Do While' format so upon completion of the main macro I
    > end up with multiple 'finished' reports.
    >
    > I'm struggling at the beginning and end of this process. I don't know
    > the code that copies an activesheet to an existing 'report' file and
    > then saves and closes the newly created file such that the original
    > 'report file' remains open and ready to use for the next open 'data'
    > file.
    >
    > I greatly appreciate any direction you have...
    >
    > Thank you,
    >
    > Tony
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1