Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-05-2016, 12:07 PM
gbaker gbaker is offline Macro to open Multiple files and copy information to a master file Windows 7 32bit Macro to open Multiple files and copy information to a master file Office 2010 32bit
Competent Performer
Macro to open Multiple files and copy information to a master file
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default Macro to open Multiple files and copy information to a master file

Hi All,
Looking for some code that would allow me to open multiple excel sheets and copy the information to a Master File. I set up a macro in Outlook that whenever the files ar received it put them in a folder on y network.


Here is an example of the data in the files that I want to copy to the Master:
Job No PackageCode File Name Date Dropped Quantity Status
461332 E-XUL E-XUL_5014605A1-0001-.PS 4/4/2016 15:17 14 Confirmed
461333 E-XUL E-XUL_5014605A1-0002-.PS 4/4/2016 15:17 177 Confirmed
461334 AFA-XUL AFA-XUL_5014605A1-0003-.PS 4/4/2016 15:17 311 Confirmed
461335 ING-XUL ING-XUL_5014605A1-0004-.PS 4/4/2016 15:17 190 Confirmed
461336 FE-XUL FE-XUL_5014605A1-0005-.PS 4/4/2016 15:17 17 Confirmed
Reply With Quote
  #2  
Old 04-08-2016, 08:28 AM
OfficeNewb OfficeNewb is offline Macro to open Multiple files and copy information to a master file Windows 10 Macro to open Multiple files and copy information to a master file Office 2013
Novice
 
Join Date: Nov 2015
Posts: 4
OfficeNewb is on a distinguished road
Default

Hello gbaker -

Below is a quick example of copying data from external text files into a master Excel Workbook.

Code:
 
Sub ImportMonthlySales()

    Dim myTextFile As Workbook
    Dim OpenFiles() As Variant
    
    OpenFiles = GetFiles()
    Application.ScreenUpdating = False
    
    For i = 1 To Application.CountA(OpenFiles)
        Set myTextFile = Workbooks.Open(OpenFiles(i))
        
        myTextFile.Sheets(1).Range("A1").CurrentRegion.Copy
        Workbooks(1).Activate
        Workbooks(1).Worksheets.Add
        ActiveSheet.Paste
        Application.CutCopyMode = False
        myTextFile.Close
    Next i
    
    Application.ScreenUpdating = True
    
End Sub
 
Private Function GetFiles() As Variant
    
GetFiles = Application.GetOpenFilename(Title:="Select File(s) to import", MultiSelect:=True)
 
End Function
Running the ImportMonthlySales() macro will prompt the user to select the file(s) to be imported. Once the file(s) is found the macro will then import the data to a worksheet in the active Excel workbook.
Reply With Quote
  #3  
Old 04-08-2016, 08:44 AM
gbaker gbaker is offline Macro to open Multiple files and copy information to a master file Windows 7 32bit Macro to open Multiple files and copy information to a master file Office 2010 32bit
Competent Performer
Macro to open Multiple files and copy information to a master file
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default

Hi,
Thanks for the help. I need to have the code go to a specific folder as soon as it runs and be able to open multiple files, copy and paste the information to a master table.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to open Multiple files and copy information to a master file Run a macro on multiple docx. files Peter Carter Word VBA 27 12-15-2022 04:10 PM
Error when trying to open .docx after I run a macro to copy data between tables in two documents reesjordan Word VBA 3 06-18-2015 12:28 AM
Macro to copy cell info to multiple documents Patrick Innes Word VBA 2 02-18-2015 08:38 PM
Macro to open Multiple files and copy information to a master file how to copy some information from one excel file to another excel file tomlam Excel Programming 4 10-01-2013 03:06 PM
Macro to open Multiple files and copy information to a master file looking for macro for multiple files bolk Word 3 05-03-2011 05:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:59 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft