+ Reply to Thread
Results 1 to 6 of 6

Create Summary Sheet with Macro Button

Hybrid View

  1. #1
    Registered User
    Join Date
    07-24-2014
    Location
    Maumee, Ohio
    MS-Off Ver
    2010
    Posts
    3

    Create Summary Sheet with Macro Button

    Hi,
    I'm working on a spreadsheet that will have the max number of tabs possible of data entry. I'm trying to eliminate as much entry error as possible so a macro button that will automatically fill in the required data for the summary sheet is ideal. Each tab will be the exactly the same size and format.
    I'm looking to create a summary sheet that will compile 3 cells (R22C17, R23C17, AND R24C17) of information from each sheet in the workbook along with their sheet name. The entries should be in rows for each sheet. And just to make things a little more complicated I'd love a hyperlink with the sheet name for each data entry (if at all possible).

    I've been messing around in VBA with other codes, but nothing this complicated!

    Thanks

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Create Summary Sheet with Macro Button

    I cant follow what you are trying to do.

    Post a sample dataset/workbook with a proper example indicative of what you are doing and then a proposed layout of what you want as an end result, and you will be more likely to receive help.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Registered User
    Join Date
    07-24-2014
    Location
    Maumee, Ohio
    MS-Off Ver
    2010
    Posts
    3

    Re: Create Summary Sheet with Macro Button

    example1.xls

    Thanks for your help! Attached is an example of what I'm trying to do. The 3 highlight cells are what I'm trying to import to the summary sheet along with the tab name.

  4. #4
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Create Summary Sheet with Macro Button

    The code is posted below. Also see the attachment.

    Option Explicit
    
    Sub ConsolidateMyData()
    
    '===================================================================
    'Declare Variables
    '===================================================================
        Dim LastRow As Integer 'Used to find the last row used on the Summary tab
        Dim SummaryTab As String 'Used to define which tab to return to at the end
        Dim ws As Worksheet ' Used to loop through the worksheets
        
    '===================================================================
    'Define Variables
    '===================================================================
        SummaryTab = ThisWorkbook.Worksheets("Summary").Name 'Defines the tab name
        LastRow = ThisWorkbook.Worksheets("Summary").Cells(Rows.Count, 1).End(xlUp).Row + 1 ' Finds the FIRST unused row on the Summary tab
    
    '===================================================================
    'Setup For Speed
    '===================================================================
        Application.ScreenUpdating = False 'turns off Screen Updating
        Application.Calculation = xlCalculationManual 'turns off Calculations
        
    '===================================================================
    'Clear Data tab before begining
    '===================================================================
        ThisWorkbook.Sheets(SummaryTab).Activate
        ThisWorkbook.Sheets(SummaryTab).Range("A2:D1048576").Clear 'Simply clears the Data tab except for the headers
    
    '===================================================================
    'Copy and Paste
    '===================================================================
        For Each ws In Worksheets
            If ws.Name <> SummaryTab Then
            Application.StatusBar = "Aggregating worksheet: " & ws.Name
                ws.Activate
                
            LastRow = ThisWorkbook.Worksheets(SummaryTab).Cells(Rows.Count, 1).End(xlUp).Row + 1 ' Calculates the first open row on the data tab
                ThisWorkbook.Worksheets(SummaryTab).Range("A" & LastRow).Value = ws.Name
                ThisWorkbook.Worksheets(SummaryTab).Range("B" & LastRow).Value = Sheets(ws.Name).Range("H29").Value
                ThisWorkbook.Worksheets(SummaryTab).Range("C" & LastRow).Value = Sheets(ws.Name).Range("H30").Value
                ThisWorkbook.Worksheets(SummaryTab).Range("D" & LastRow).Value = Sheets(ws.Name).Range("H31").Value
            End If
        Next ws
    
    '===================================================================
    'End Macro Procedures
    '===================================================================
        ThisWorkbook.Sheets(SummaryTab).Activate 'Returns to the SummaryTab
        Application.StatusBar = False 'Clears the Statusbar
        Application.ScreenUpdating = True 'turns screen updating back on
        Application.Calculation = xlCalculationAutomatic ' turns calculations back on
        ThisWorkbook.RefreshAll 'Refreshes all pivot tables
        MsgBox "Data Consolidation Complete" 'offers a message box
    
    End Sub
    ConsolidateDataToOneTab.xlsm

  5. #5
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Create Summary Sheet with Macro Button

    To change to a hyperlink change the following:

    Worksheets(SummaryTab).Hyperlinks.Add Anchor:=Worksheets(SummaryTab).Cells(LastRow, 1), Address:="", _
                    SubAddress:="'" & ws.Name & "'!A1", TextToDisplay:=ws.Name ' Adds a hyperlink in column A
                'ThisWorkbook.Worksheets(SummaryTab).Range("A" & LastRow).Value = ws.Name 'Used to apply name to column A

  6. #6
    Registered User
    Join Date
    07-24-2014
    Location
    Maumee, Ohio
    MS-Off Ver
    2010
    Posts
    3

    Re: Create Summary Sheet with Macro Button

    It works! Thanks for your help!

+ 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. [SOLVED] VBA / Macro help needed to create summary report from another sheet
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-24-2014, 04:47 PM
  2. [SOLVED] Simple Macro to Create Summary Sheet
    By CRW in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-16-2014, 03:14 PM
  3. [SOLVED] Need a macro to create a summary sheet
    By rgeorge in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 02-07-2014, 12:26 PM
  4. [SOLVED] Macro button copy specific rows from all worksheets to a summary sheet
    By cme in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-17-2013, 10:22 PM
  5. [SOLVED] Need a Simple Macro to Create Summary Sheet
    By CRW in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-31-2012, 06:37 PM

Tags for this Thread

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