June 2004
Home Up Tips Directory Links of Interest Site Map FAQs

 Wednesday, June 9,  2004   

SIG LEADER ELECTION! at 8:00 pm.
Anyone who wants to help run the SIG for the 2004-2005 year is welcome and urged to nominate themselves.     I will put myself up for re-election, but I need help to cover meeting dates where I am out of town.

6:30-7:00 pm 

General Questions and Problems from the Audience
Aggravations.

7:00 - 8:00 Create "Snapshots" of Spreadsheets.

Copy the results of a big model and paste just the values and formats into a much smaller workbook for a report.

Make a macro to do this on a bunch of cases.
An introduction to Excel Macros to add worksheets, copy and paste, and save snapshots

(Copyright of the source data prevents me from posting the workbooks.   Sorry.   The Snapshot Macro code is posted below.)
8:00 SIG LEADER ELECTIONS
  (Break)
8:10 - 9:00 More Pivot Tables with Charts:  (time permitting)

Display data with Pivot Charts
Formulas in Pivot Tables
Formatting tricks for Pivot Tables.

 

VBA for the "Take Snap Shot Button".   It reads the Industry from the Page field
then copies the entire sheet.   It opens a workbook of snap shot pages.
It creates a new page named by the industry, then pastes values and formats.
Finally it returns to the live pivot table for more work.

This is  useful technique to send just the results of a pivot table my mail and
not the entire pivot table.   It saves space and it is better security.
Sub TakeSnapshot()
'   Select the page of the pivotTable.
'    ActiveSheet.PivotTables("PivotTable1").PivotFields("Industry Group Name     "). _
'        CurrentPage = "Banks-Super Regional    "
'manually select the Pivot sheet.
'   Copy the sheet
    'Cells.Select
    'Selection.Copy
    Dim strIGName As String      'The industry Group Name to name the sheet we create.
    Dim wsPivot As Worksheet
    Dim strSuffix As String
    
    Set wsPivot = ActiveSheet
    strIGName = wsPivot.PivotTables("PivotTable1").PivotFields("Industry Group Name     ").CurrentPage
    strIGName = Trim(strIGName)
    strSuffix = Left(strIGName, 4)
    
    Cells.Copy

    'Goto the Snapshop, make new sheet
    'Windows("SnapShot.xls").Activate
    halActivateSnapShot2 (strSuffix)   ' Active or open the Snapshot.xls'
    ActiveWindow.WindowState = xlNormal  
    Sheets.Add

'Paste Values and Formats into new worksheet  
    Cells.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Cells.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
        
'Rename the sheet
    strIGName = Replace(strIGName, "/", "_")
    ActiveSheet.Name = strIGName
'go back to the pivot sheet.
    wsPivot.Activate
    Application.CutCopyMode = False
End Sub


Sub halActivateSnapShot()
    On Error GoTo OpenWorkbook
    Windows("SnapShot.xls").Activate
    Exit Sub
OpenWorkbook:
    Workbooks.Open "Snapshot.xls"  
End Sub

Sub halActivateSnapShot2(strSufx As String)
    On Error GoTo OpenWorkbook
    Dim strWBName As String
    strWBName = "SnapShot" & strSufx & ".xls"
    Windows(strWBName).Activate
    Exit Sub
OpenWorkbook:
    On Error GoTo CreateWorkbook
    Workbooks.Open strWBName
    Exit Sub  
CreateWorkbook:
    On Error GoTo Oops
        Workbooks.Add
    ActiveWorkbook.SaveAs strWBName
    Exit Sub
Oops:
    MsgBox "we shouldn't be here!"  
End Sub


For questions or comments concerning content on this website: Stephen Rasey
Design of this site by Cheryl D. Wise
Copyright © 2000-2004 by WiserWays. All rights reserved.
Revised: 2005-07-10 01:08 .