+ Reply to Thread
Results 1 to 9 of 9

Macro to extract data from other excel files

  1. #1
    Registered User
    Join Date
    10-14-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Macro to extract data from other excel files

    Hello,

    My uncle asked me to find a way to extract data from more than 250 excel files and dump them into a single excel file.

    Is there a macro that will allow me to extract them quickly ?

    Thank you

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Macro to extract data from other excel files

    It depends what you mean by extract. Does it mean take a single sheet out of each workbook and create a workbook of 250 sheets or does it mean taking a range of data from each workbook and putting it into a single sheet or something else.

    A couple of sample workbooks with before and after would help getting you a solution.
    Martin

  3. #3
    Registered User
    Join Date
    10-14-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Re: Macro to extract data from other excel files

    Hello mrice

    It means the latter.
    I want to take the column from each 250 sheets and paste them into a single workbook.

  4. #4
    Registered User
    Join Date
    10-14-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Re: Macro to extract data from other excel files

    any help please

  5. #5
    Registered User
    Join Date
    10-14-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Re: Macro to extract data from other excel files

    Hello,

    I recorded the macro and here what I got

    Sub SalaryTracker()
    '
    ' SalaryTracker Macro
    '

    '
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("C8:D8").Select
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    Range("C3").Select
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("H34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    Range("D3").Select
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("M34:N34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    Range("F3").Select
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("F34:G34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    Range("H3").Select
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Windows("Book3").Activate
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("P34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    Range("I3").Select
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("Q34:T34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    End Sub


    How can I make it more efficient ? and replace "salary estimator..." with the current window open because they have different names.

    Thanks

  6. #6
    Registered User
    Join Date
    10-14-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Macro extract from other excel files

    Hello,

    My uncle asked me to find a way to extract data from more than 250 excel files and dump them into a single excel file.

    I did a record from one single excel file and I got this:

    Sub SalaryTracker()
    '
    ' SalaryTracker Macro
    '

    '
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("C8:D8").Select
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    Range("C3").Select
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("H34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    Range("D3").Select
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("M34:N34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    Range("F3").Select
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("F34:G34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    Range("H3").Select
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Windows("Book3").Activate
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("P34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    Range("I3").Select
    Windows("Salary Estimator Model Final US GMI 2015 September Final.xlsm"). _
    Activate
    Range("Q34:T34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("Book3").Activate
    ActiveSheet.Paste
    End Sub


    How can I make it more efficient ? and replace "salary estimator..." with the current window open because they have differnt names.

    Thanks

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to extract data from other excel files

    Here's a free add-in that may do what you want.

    RDBMerge, Excel Merge Add-in
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  8. #8
    Registered User
    Join Date
    10-14-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Re: Macro to extract data from other excel files

    Should I open all the 250 excel files at once so I can use this add in ?

  9. #9
    Registered User
    Join Date
    10-14-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Re: Macro to extract data from other excel files

    any help please ?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to extract multiple segments of data from files
    By tomuk19 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-10-2013, 10:06 AM
  2. Macro to extract data from different files
    By vijanand1279 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-09-2013, 07:15 AM
  3. [SOLVED] Need Help for creating a Macro to extract specific data from all files in a folder.
    By shaiq123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-10-2013, 02:08 PM
  4. Need Macro to open and extract data from from multiple txt files
    By Sun Devil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2012, 12:25 PM
  5. Help me with a Macro to extract data from multiple files without opening them?
    By matador_24 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-03-2011, 03:23 PM
  6. macro to extract data from files to another worksheet.
    By sandbach in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2011, 11:29 AM

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