+ Reply to Thread
Results 1 to 20 of 20

Merging or Appending Multiple Worksheets to one Worksheet

Hybrid View

  1. #1
    Registered User
    Join Date
    05-03-2013
    Location
    houston
    MS-Off Ver
    Excel 2010
    Posts
    14

    Merging or Appending Multiple Worksheets to one Worksheet

    Hello,

    I have been working on this file for a while and can't figure out how to move the data from sheets 1, 2, and 3 to Summary. There is a lot of data so I do not want to have to copy and paste it everyday. Can someone help me find a way to merge the columns and append them to the corresponding column? I really do not know if I am explaining this right, but any help would be greatly appreciated. Thank you.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    05-03-2013
    Location
    houston
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    Any suggestions would be greatly appreciated.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    Hi kopico

    Welcome to the Forum!

    If I understand your issue, this Code appears to do as you require. You'll need to play with the Formating of the output. I've demonstrated how to do that in the second to last line of the Code
    Option Explicit
    
    Sub Merge_Sheets()
        Dim sLR As Long, sLC As Long, tNR As Long, tCol As Long
        Dim sWs As Worksheet, tWs As Worksheet
        Dim sRng As Range
        Dim sCel As Range
    
        Set tWs = Sheets("Summary")
    
        For Each sWs In ThisWorkbook.Sheets
            If Not sWs.Name = "Summary" Then
                Application.ScreenUpdating = False
                tNR = tWs.Cells.Find("*", tWs.Cells(Rows.Count, Columns.Count), SearchOrder:=xlByRows, _
                        SearchDirection:=xlPrevious).Row + 1
                With sWs
                    sLR = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), SearchOrder:=xlByRows, _
                            SearchDirection:=xlPrevious).Row
                    sLC = .Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByColumns, _
                            SearchDirection:=xlPrevious).Column
                    Set sRng = .Range(.Cells(1, 1), .Cells(1, sLC))
                    For Each sCel In sRng
                        .Range(.Cells(2, sCel.Column), .Cells(sLR, sCel.Column)).Copy
                        On Error Resume Next
                        tCol = WorksheetFunction.Match(sCel, tWs.Rows("1:1"), 0)
                        tWs.Cells(tNR, tCol).PasteSpecial (xlPasteValues)
                        On Error GoTo 0
                    Next sCel
                End With
            End If
            Application.CutCopyMode = False
        Next sWs
        tWs.Columns(1).NumberFormat = "m/d/yyyy"
        Application.ScreenUpdating = True
    End Sub
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    05-03-2013
    Location
    houston
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    WOW!! Thank you!!

  5. #5
    Registered User
    Join Date
    05-03-2013
    Location
    houston
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    Is there a way to have it update the rows when I add data to sheets 1, 2, 3?

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    Hi kopico

    It'd be much simpler to clear the Summary Sheet and rerun the Code on the updated files...is this acceptable?

  7. #7
    Registered User
    Join Date
    05-03-2013
    Location
    houston
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    Yeah that would work. All the columns need to be there. If I were to add columns would those go on the summary sheet?

  8. #8
    Registered User
    Join Date
    05-03-2013
    Location
    houston
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    Quote Originally Posted by jaslake View Post
    Hi kopico

    It'd be much simpler to clear the Summary Sheet and rerun the Code on the updated files...is this acceptable?
    Jaslake,

    There will actually be a lot of data so it would work out better if I didn't have to erase the summary sheet every time I wanted to update. If there is a way to make it update, I would greatly appreciate it. Thank you.

  9. #9
    Registered User
    Join Date
    05-03-2013
    Location
    houston
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    Wow man thanks, it works great. I do have a question, if I have a lot of data in the worksheets how will that affect the worksheets?

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    Hi kopico

    Well, run the Code on
    if I have a lot of data in the worksheets how will that affect the worksheets
    then you tell me...we won't really know until you try it. You may see a slight degradation of the speed with which the Code completes the task but probably nothing to be disconcerted about.

    The proof is in the pudding...try it...let me know.

  11. #11
    Registered User
    Join Date
    05-03-2013
    Location
    houston
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    Jaslake,

    So the code works great. I was wondering, is there a way that I can update a cell that has been processed and it will automatically update in the summary sheet??

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    Hi kopico

    I'd suggest it depends on what you wish to do. If you wish to change ANY field then I'd recommend going back to the original concept of rebuilding the file.

    If you wish to change specific, limited fields then you need to define what it is you wish to do...Code requires definition else it can't do as you require.

    What do you have in mind?

  13. #13
    Registered User
    Join Date
    05-03-2013
    Location
    houston
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Merging or Appending Multiple Worksheets to one Worksheet

    On each sheet i made columns where it will divide the net by number of days in a month that has passed and in another column divide the net by the number of days in the year that has passed. Since may has not pass the number of days will keep increasing as the days go by but they do not update in the summary sheet cause the row has already been processed. Is there a way to make that columns automatically update?

+ 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