LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ThisWorkbook of personal.xls Jack Sons Excel Discussion (Misc queries) 4 August 29th 07 04:28 PM
Creating a macro that writes to all worksheets ___Zoom[_3_] Excel Programming 4 August 4th 07 07:54 AM
Macro that writes Macros schoujar[_19_] Excel Programming 1 June 1st 06 04:59 AM
Personal macro workbook and personal.xls John Kilkenny Excel Discussion (Misc queries) 1 June 14th 05 09:43 PM


All times are GMT +1. The time now is 01:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"