Results 1 to 3 of 3

Help creating Summary Page w/ user defined sheet names

Threaded View

gophil1 Help creating Summary Page w/... 07-30-2012, 08:51 PM
arlu1201 Re: Help creating Summary... 07-31-2012, 04:18 AM
gophil1 Re: Help creating Summary... 07-31-2012, 07:35 AM
  1. #1
    Registered User
    Join Date
    07-25-2012
    Location
    CT
    MS-Off Ver
    Excel 2016
    Posts
    37

    Help creating Summary Page w/ user defined sheet names

    I'll do my best to explain. Need help creating a summary page using a macro crafted by JBeaucaire that creates worksheets in a workbook generated by a column of location names that are entered by various managers. The number of locations and their respective names are unknown. However, the worksheets created are essentially copies of a template called "Master" and the worksheet with the location names is called "Locations". I'm looking to add up the same totals for all of worksheets, except "Locations" and "Master" which appear in column "BD" starting with cell BD8 on all of the copied sheets and have the totals appear in column "C" starting with cell C8 on the "Summary Page". I did some minor tweaking to the code that JBeaucaire provided below:

    Option Explicit
    
    Sub AddNamedSheets()
    Dim NmRNG As Range, Nm As Range
    
        If Sheet2.Range("A1").Value = Empty Then
            MsgBox "Please Enter Location Name"
            Exit Sub
        End If
        'Application.ScreenUpdating = False
        'Sheets("Master").Visible = True
        On Error Resume Next
        Set NmRNG = Sheets("Locations").Range("A3:A41").SpecialCells(xlConstants)
        If NmRNG Is Nothing Then
            MsgBox "Depot List empty, please add location"
            Exit Sub
        End If
    
        For Each Nm In NmRNG
            'make sure the sheet doesn't exist already
            If Not Evaluate("ISREF('" & Nm.Value & "'!A1)") Then
                Sheets("Master").Copy After:=Sheets(Sheets.Count)
                ActiveSheet.Name = Nm.Value
                ActiveSheet.Cells(5, 2) = Nm.Value
            End If
        Next Nm
        'Sheets("Master").Visible = False
        'Application.ScreenUpdating = True
        'Sheet1.Visible = xlSheetVeryHidden
       
    End Sub
    Any help is appreciate. I wasn't sure if I could use for example: Sum('Sheet4:Sheet41'BD8) seeing that I wouldn't know how many sheets would be created; the maximum number of sheets is 41.

    The code that I was trying to use to create the Summary Page is, but it only totals the last entry on the locations worksheet ignoring all others:

    Sub CopyToSummary()
      Dim OutSH As Worksheet
        Set OutSH = Sheets("Summary")
        For Each sh In Worksheets
            If sh.Name <> "Summary" Then
                sh.Range("bd8:BD87").Copy
                OutSH.Cells(8, 3).End(xlUp).Offset(1, 0).Select
                ActiveSheet.Paste link:=True
            End If
             
        Next sh
    End Sub
    Last edited by gophil1; 07-30-2012 at 09:06 PM. Reason: Additional info left out.

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