Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Personal.xls macro that writes to ThisWorkBook
I've writen a macro that only runs when my user needs to run the marco. Here
is what the marco does: 1) User opens a SAP report which needs to be formated. 2) User runs my macro to format the report 3) Macro also creats a PivotTable on worksheet "Discounts". 4) User might need to update one of the fields in Data worksheet and if the user wants to have the PivotTable updated, they have to click on the PivotTable and then Refresh the data. Here is what I would like to do: I would like it so that when the macro runs, it would put some code in the "ThisWorkbook" that will do the following : Private Sub Workbook_SheetActivate(ByVal Sh As Object) Dim DisSheet, CurSheet DisSheet = "Discounts" CurSheet = ActiveCell.Worksheet.Name If CurSheet = DisSheet Then GoTo 10 If CurSheet < DisSheet Then GoTo 20 10: Sheets("Discounts").Select Range("A3").Select ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh 20: End Sub How do I do this by adding it to my Macro in my Personal.xls file? Derek |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ThisWorkbook of personal.xls | Excel Discussion (Misc queries) | |||
Creating a macro that writes to all worksheets | Excel Programming | |||
Macro that writes Macros | Excel Programming | |||
Personal macro workbook and personal.xls | Excel Discussion (Misc queries) |