+ 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

    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.

  2. #2
    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.

+ 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