+ Reply to Thread
Results 1 to 9 of 9

Creating Master Summary from multiple sheets

  1. #1
    Registered User
    Join Date
    05-31-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    8

    Creating Master Summary from multiple sheets

    Hi All!

    I am trying to create a master summary sheet (for the entire year) from mutiple sheets (each sheet being a month). I would like the master to update automtacially when changes are made in each monthly tab. I have attached a sample document and am currently using the following VBA coding


    Sub Summary()
    Dim i As Long
    Dim lr As Long
    Dim ws As Worksheet
    Dim x As String


    Sheets.Add.Name = "Master Sheet 2013"

    x = Array("July", "Aug", "Sept", "Oct", "Nov", "Dec", "Jan", "Feb", "Mar", "Apr", "May", "Jun")

    For i = LBound(x) To UBound(x)

    lr = Cells(Rows.Count, 1).End(3).Row

    Range(Range("A"), Range("A" & lr)).EntireRow.Copy Sheets("Master Sheet 2013").Range("A" & Rows.Count).End(xlUp)(2)

    Next i


    End Sub


    I am clearly missing something and ANY help would be appreciated! Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Creating Master Summary from multiple sheets

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    05-31-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Creating Master Summary from multiple sheets

    Thank you for your help! Is there a way to make the master automatically update when changes and/or additional rows are added to the monthly sheets?

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Creating Master Summary from multiple sheets

    Yes, but you have to put many formulas in master sheet to get values of each sheet, it's a big job.
    you can delete mastersheet and run this code again

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Creating Master Summary from multiple sheets

    Hi, krosser,

    put the code into the Worksheet_Activate-event in Sheet Master - clear Usedrange there and then run code.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Creating Master Summary from multiple sheets

    good idea, don't delete mastersheet, put in his module
    Please Login or Register  to view this content.
    each time you select mastersheet the code runs

  7. #7
    Registered User
    Join Date
    05-31-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Creating Master Summary from multiple sheets

    Thank you all so much! It worked perfectly! I really appreaciate all the help

  8. #8
    Forum Contributor
    Join Date
    07-21-2011
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2007,2010,2016
    Posts
    695

    Re: Creating Master Summary from multiple sheets

    Quote Originally Posted by krosser View Post
    Thank you all so much! It worked perfectly! I really appreaciate all the help
    Private Sub Worksheet_Activate()
    Dim SummarySheet As Worksheet
    Dim FolderPath As String
    Dim FileName As String
    Dim n As Long
    Dim SourceRange As Range
    Dim DestRange As Range
    Dim WB As Workbooks
    FolderPath = "C:\Users\aruna\Desktop\Oops\"
    FileName = Dir(FolderPath & "*.xls*")
    Set WorkBk = Workbooks.Open(FolderPath & FileName)
    SummarySheet.Range("A" & NRow).Value = FileName
    Set SourceRange = WorkBk.Worksheets(1).Range("A9:bz9")
    Set DestRange = SummarySheet.Range("B" & NRow)
    Set DestRange = DestRange.Resize(SourceRange.Rows.Count, _
    SourceRange.Columns.Count)
    ActiveSheet.UsedRange.EntireRow.Delete
    Set SourceRange = WorkBk.Worksheets(1).UsedRange.EntireRow.Delete
    x = Array("July", "Aug", "Sept", "Oct", "Nov", "Dec", "Jan", "Feb", "Mar", "Apr", "May", "Jun")
    For i = LBound(x) To UBound(x)
    lr = Cells(Rows.Count, 1).End(3).Row
    Sheets(x(i)).UsedRange.Copy Sheets("Master Sheet 2013").Range("A" & Rows.Count).End(xlUp)(2)
    Next i
    WorkBk.Close savechanges:=False
    End Sub



    Dude i want pass the code through multiple closed workbooks i almost done but there some error

    i got struck here..please help me out urgent

    every workbook in path range copy to Master Sheet 2013


    SummarySheet.Range("A" & nRow).Value = FileName

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Creating Master Summary from multiple sheets

    Hi, breadwinner,

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.



    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here




    I would not work with the WorkSheet_Activate-event for reading out contents from closed workbooks, IŽd referred to the Workbook_Open here. Assuming that Summary is the codename for the destination sheet, otherwise you would need to set it in order for the code to work:
    Please Login or Register  to view this content.
    Ciao,
    Holger

+ 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