+ Reply to Thread
Results 1 to 17 of 17

Combine data of some cells in multiple excel files into one sheet

Hybrid View

ricdamiani Combine data of some cells in... 08-05-2013, 01:53 AM
Naveed Raza Re: Combine data of some... 08-05-2013, 03:10 AM
lotuxel Re: Combine data of some... 08-05-2013, 03:41 AM
ricdamiani Re: Combine data of some... 08-05-2013, 08:11 AM
Naveed Raza Re: Combine data of some... 08-05-2013, 10:17 AM
ricdamiani Re: Combine data of some... 08-06-2013, 02:28 AM
ricdamiani Re: Combine data of some... 08-06-2013, 05:31 AM
lotuxel Re: Combine data of some... 08-06-2013, 06:05 AM
ricdamiani Re: Combine data of some... 08-06-2013, 06:36 AM
lotuxel Re: Combine data of some... 08-06-2013, 10:02 PM
ricdamiani Re: Combine data of some... 08-06-2013, 08:46 PM
Ariff_Chowdhury Re: Combine data of some... 08-06-2013, 09:43 PM
ricdamiani Re: Combine data of some... 08-06-2013, 10:56 PM
Ariff_Chowdhury Re: Combine data of some... 08-06-2013, 11:07 PM
ricdamiani Re: Combine data of some... 08-06-2013, 11:31 PM
Ariff_Chowdhury Re: Combine data of some... 08-06-2013, 11:36 PM
Naveed Raza Re: Combine data of some... 08-07-2013, 12:07 AM
  1. #1
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Unhappy Combine data of some cells in multiple excel files into one sheet

    Hi guys,

    I have hundreds of sheets with the same layout and I need to extract data from those sheets into 1 sheet.

    There is a very similar topic I found some days ago in this forum, but my case is a bit different, as I need to extract the info only from some cells. The topic is below and Alf solved the problem:
    http://www.excelforum.com/excel-prog...worksheet.html

    The sheets are all into the following folder: C:\Users\5 - PRODUCTION\RUN SHEETS\
    The cells it needs the extract the information are: C3, C5, C8, D8, E8, D9, G13, H13, F22, F24, F26, F29, F31, F34, F40, D43, E43, F46, D49, E49, F52, F55, C58, C59, C60, C61, C62

    There is a macro that can extract the info from these cells into a single sheet?
    This can save me some months of manually typing all this info :/

    You can find below 1 of those hundreds (maybe thousands) sheets I need to extract the info:
    2308.E5.xls

    Really hope you guys can help me on that!
    Thank you!
    Last edited by ricdamiani; 08-06-2013 at 11:33 PM.

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Combine data of some cells in multiple excel files into one sheet

    Hi ricdamiani

    In which way want the combine data means rows wise or column wise.
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Registered User
    Join Date
    11-14-2010
    Location
    Macau
    MS-Off Ver
    Excel 2003
    Posts
    66

    Re: Combine data of some cells in multiple excel files into one sheet

    Pls try attached which modified from your file!
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Combine data of some cells in multiple excel files into one sheet

    Quote Originally Posted by Naveed Raza View Post
    Hi ricdamiani

    In which way want the combine data means rows wise or column wise.
    Hi Naveed Raza,
    Thank you for your reply.

    The idea is every single excel file is a row, and the cells I mentioned are the columns.
    Do you think it is possible?

    Thanks for that.

    Quote Originally Posted by lotuxel View Post
    Pls try attached which modified from your file!
    Hi lotuxel,
    Thank for your reply as well.

    I had a look in the file and I didn't understand your macro.
    Actually the goal is to get all the data from the mentioned cells from hundreds of excel files and combine them into 1 sheet.
    The files would be the rows and the cells I mentioned would be the columns.
    The sheets are all into C:\Users\5 - PRODUCTION\RUN SHEETS\

    Is it something similar you did in your macro?

    I thank you in advance.

  5. #5
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Combine data of some cells in multiple excel files into one sheet

    for better understanding please provide one 3,4 workbook combine sample workbook.

  6. #6
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Combine data of some cells in multiple excel files into one sheet

    Hi Naveed Raza,
    Thank you for your reply.

    Please find attachments below:
    0102.E1.xls
    1282.E2.xls
    2007.E2.xls
    2310.E3.xls
    Goal.xlsx

    The goal sheet show the sheet I am looking for, with this structure, that compile all the other sheets into this one. The letters+number inside the cells are the cell number I need to extract from the other sheets.
    The other sheets I attached, are examples of some of the sheets that I need to extract the information. You can see that the red cells are the cells I want to extract the information.

    Do you think it is possible?

    I thank you in advance.
    Last edited by ricdamiani; 08-06-2013 at 02:31 AM.

  7. #7
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Combine data of some cells in multiple excel files into one sheet

    Hi guys,

    Anybody else can help with that?!

    Cheers!

  8. #8
    Registered User
    Join Date
    11-14-2010
    Location
    Macau
    MS-Off Ver
    Excel 2003
    Posts
    66

    Re: Combine data of some cells in multiple excel files into one sheet

    Hi rocdamiani,
    Pls see below and you have to put all the files to one file's sheets and Goal sheet is target sheet.
    Sub jw_test()
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim ws1 As Worksheet
    Dim re As Variant
    Dim i As Long
    Dim j As Long
    Dim rng As String
       
    Set wb = ActiveWorkbook
    Set ws = wb.Worksheets("Goal")
    j = 2
    For Each ws1 In wb.Worksheets
    
       If ws1.Name <> "Goal" Then
             ws.Cells(j, 1) = ws1.Name
          For i = 0 To 100
                re = Array("C3", "C5", "C8", "D8", "E8", "D9", "G13", "H13", "F22", "F24", "F26", "F29", "F31", "F34", "F40", "D43", "E43", "F46", "D49", "E49", "F52", "F55", "C58", "C59", "C60", "C61", "C62", "")
                rng = re(i)
                If rng = "" Then Exit For
                    ws.Cells(j, i + 2) = ws1.Range(rng).Value
         Next i
         End If
         j = j + 1
    Next ws1
    End Sub

  9. #9
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Combine data of some cells in multiple excel files into one sheet

    Quote Originally Posted by lotuxel View Post
    Hi rocdamiani,
    Pls see below and you have to put all the files to one file's sheets and Goal sheet is target sheet.
    Sub jw_test()
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim ws1 As Worksheet
    Dim re As Variant
    Dim i As Long
    Dim j As Long
    Dim rng As String
       
    Set wb = ActiveWorkbook
    Set ws = wb.Worksheets("Goal")
    j = 2
    For Each ws1 In wb.Worksheets
    
       If ws1.Name <> "Goal" Then
             ws.Cells(j, 1) = ws1.Name
          For i = 0 To 100
                re = Array("C3", "C5", "C8", "D8", "E8", "D9", "G13", "H13", "F22", "F24", "F26", "F29", "F31", "F34", "F40", "D43", "E43", "F46", "D49", "E49", "F52", "F55", "C58", "C59", "C60", "C61", "C62", "")
                rng = re(i)
                If rng = "" Then Exit For
                    ws.Cells(j, i + 2) = ws1.Range(rng).Value
         Next i
         End If
         j = j + 1
    Next ws1
    End Sub
    Hi lotuxel,
    Thank you for your reply.

    Sorry but I didn't understand very well.
    I thought the macro was going to open each excel file in the folder and copy those cells into the goal sheet.
    Is that happening in the macro? Or how it works? I couldn't understand very well your explanation before the code

    Looking forward to hear from you
    Last edited by ricdamiani; 08-06-2013 at 06:38 AM.

  10. #10
    Registered User
    Join Date
    11-14-2010
    Location
    Macau
    MS-Off Ver
    Excel 2003
    Posts
    66

    Re: Combine data of some cells in multiple excel files into one sheet

    Quote Originally Posted by ricdamiani View Post
    Hi lotuxel,
    Thank you for your reply.

    Sorry but I didn't understand very well.
    I thought the macro was going to open each excel file in the folder and copy those cells into the goal sheet.
    Is that happening in the macro? Or how it works? I couldn't understand very well your explanation before the code

    Looking forward to hear from you
    Yes!, I try to add the purposes :
    'assign the active workbook
    Set wb = ActiveWorkbook
    'assign ws to target sheet
    Set ws = wb.Worksheets("Goal")
    j = 2
    'loop all the sheets in active workbook
    For Each ws1 In wb.Worksheets
    'if the sheet (ws) 's name is not Goal
       If ws1.Name <> "Goal" Then
          'put the sheet name to goal sheet start from row no. 2 and col A
             ws.Cells(j, 1) = ws1.Name
           'loop the all required range start from C3
          For i = 0 To 100
                re = Array("C3", "C5", "C8", "D8", "E8", "D9", "G13", "H13", "F22", "F24", "F26", "F29", "F31", "F34", "F40", "D43", "E43", "F46", "D49", "E49", "F52", "F55", "C58", "C59", "C60", "C61", "C62", "")
                rng = re(i)
                   'if all range finsihed
                If rng = "" Then Exit For
                'place the data (value) of target sheet value from the range from from array
                    ws.Cells(j, i + 2) = ws1.Range(rng).Value
         Next i
         End If
         'prepare for next row in goal sheet
         j = j + 1
         'start to next sheet
    hope you got the idea.

  11. #11
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Combine data of some cells in multiple excel files into one sheet

    Hi guys,

    Anyone able to help me on that now?

    Cheers!

  12. #12
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Combine data of some cells in multiple excel files into one sheet

    Hi ricdamiani,
    please find attached,let us know if this serves your purpose or not!

    Goal.xlsm

    Thanks

  13. #13
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Combine data of some cells in multiple excel files into one sheet

    Just a second i think i solved
    Last edited by ricdamiani; 08-06-2013 at 11:01 PM.

  14. #14
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Combine data of some cells in multiple excel files into one sheet

    Hi ricdamiani,
    Did you check the file i sent ? anyways pasting here
    Private Sub Workbook_Click()
       
        Dim wbMaster As Workbook
        Dim ws       As Worksheet
        Dim desws    As Worksheet
        Dim NextRow  As Long
        Dim Fpath    As String
        Dim Fname    As String
        Dim strName  As String
        Dim j        As Long
        j = 2
        Set wbMaster = Workbooks("Goal.xlsm")
        Set desws = Worksheets("Sheet1")
        Fpath = "C:\Users\Username\Desktop\forum\" ' change to your directory
        Fname = Dir(Fpath & "2*.xls")
        
        Application.ScreenUpdating = False
        
        Do While Fname <> ""
            
    
            'strName = Left(InStr(Fname, ".") - 1)
            strName = Left(Fname, InStr(Fname, "."))
            With Workbooks.Open(Fpath & Fname)
            
                For Each ws In .Sheets(Array("Sheet1"))
                
                    
                        For i = 0 To 100
                        re = Array("C3", "C5", "C8", "D8", "E8", "D9", "G13", "H13", "F22", "F24", "F26", "F29", "F31", "F34", "F40", "D43", "E43", "F46", "D49", "E49", "F52", "F55", "C58", "C59", "C60", "C61", "C62", "")
                        rng = re(i)
                        If rng = "" Then Exit For
                        desws.Cells(j, i + 2) = ws.Range(rng).Value
                        desws.Cells(j, 1) = strName
    
                        Next i
                        j = j + 1
                Next ws
                
                .Close SaveChanges:=False
            
            End With
            
            Fname = Dir
             
        Loop
        
        Application.ScreenUpdating = True
    End Sub

  15. #15
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Combine data of some cells in multiple excel files into one sheet

    Quote Originally Posted by Ariff_Chowdhury View Post
    Hi ricdamiani,
    Did you check the file i sent ? anyways pasting here
    Hi Ariff,

    IT WORKED!!!!
    Thanks a loooooooooooot!!!!
    You are the best HAHHAHA

    Cheers!
    Ric

  16. #16
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Karachi, Sindh, Pakistan
    MS-Off Ver
    Excel 2010 - 2013
    Posts
    142

    Re: Combine data of some cells in multiple excel files into one sheet

    You're welcome!
    if you are satisfied with the solution provided so please mark this thread as solved! So other can reach to this easily

    Thank you too

  17. #17
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Combine data of some cells in multiple excel files into one sheet

    Hi ricdamiani

    Try this..
    put all the files in folder and put Goal file separtly and open the goal file and press alt + f8 and run it.
    Attached Files Attached Files

+ 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. How to consolidate data from multiple excel files into single sheet in new book?
    By Pradeep M B in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-07-2013, 09:37 AM
  2. Load multiple excel files into an excel sheet and extract data
    By Martijn79 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-03-2013, 06:08 PM
  3. Combine multiple excel files to one
    By anoopbaiju in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-03-2013, 09:04 AM
  4. copy multiple excel files data into one sheet?
    By jayh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2005, 09:05 AM
  5. how to combine multiple files in ms excel
    By fifi in forum Excel General
    Replies: 1
    Last Post: 01-12-2005, 08:06 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