Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have created a Pivot table having one Macro in the
Worksheet_calculate sub.In this macro I dynamically change the formula of a calculated field depending upon the selection made in one of the page fields. How ever I am having a strange problem in this pivot. Here UNDO and REDO buttons are disabled/ Can any one please suggest me how to correct this? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Most macro code clears the undo history as a by product of running.
It appears your code fits into this category. -- Regards, Tom Ogilvy "Shailesh" wrote: I have created a Pivot table having one Macro in the Worksheet_calculate sub.In this macro I dynamically change the formula of a calculated field depending upon the selection made in one of the page fields. How ever I am having a strange problem in this pivot. Here UNDO and REDO buttons are disabled/ Can any one please suggest me how to correct this? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
First of all thanks for your time and apologies for direcly copying
you .I am doing this as this report is urgent for me and ai am struck in it. Is there any remedy to it. Or do you have any other solution for what I am doing with this macro? I have created a Pivot table and to dynamically calculate a calculated field depending upon the selection in a page field I have written a small piece of VBA code in Worksheet_Calculate event. But this disables/deactivates Undo/Redo button at the top. For your reference the VBA code is written below. Private Sub Worksheet_Calculate() On Error Resume Next Application.EnableEvents = False Select Case ActiveSheet.PivotTables("PivotTable1").PivotFields ("Income ").CurrentPage Case "(All)" ActiveSheet.PivotTables("PivotTable1").CalculatedF ields( _ "INC%").StandardFormula = "=inc_segT/appr_apps" Case "HIC" ActiveSheet.PivotTables("PivotTable1").CalculatedF ields( _ "INC +%").StandardFormula = "=inc_segH/appr_apps" Case "NHIC" ActiveSheet.PivotTables("PivotTable1").CalculatedF ields( _ "INC- %").StandardFormula = "=inc_segN/appr_apps" End Select Me.Calculate Application.EnableEvents = True End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
tom said, (translated somewhat differently):
running ANY code clears the undo/redo history. macros cannot be undone unless they are coded that way. so once you run the macro, you have nothing to undo, until you have done other things. :) susan On Apr 26, 2:16 am, Shailesh wrote: First of all thanks for your time and apologies for direcly copying you .I am doing this as this report is urgent for me and ai am struck in it. Is there any remedy to it. Or do you have any other solution for what I am doing with this macro? I have created a Pivot table and to dynamically calculate a calculated field depending upon the selection in a page field I have written a small piece of VBA code in Worksheet_Calculate event. But this disables/deactivates Undo/Redo button at the top. For your reference the VBA code is written below. Private Sub Worksheet_Calculate() On Error Resume Next Application.EnableEvents = False Select Case ActiveSheet.PivotTables("PivotTable1").PivotFields ("Income ").CurrentPage Case "(All)" ActiveSheet.PivotTables("PivotTable1").CalculatedF ields( _ "INC%").StandardFormula = "=inc_segT/appr_apps" Case "HIC" ActiveSheet.PivotTables("PivotTable1").CalculatedF ields( _ "INC +%").StandardFormula = "=inc_segH/appr_apps" Case "NHIC" ActiveSheet.PivotTables("PivotTable1").CalculatedF ields( _ "INC- %").StandardFormula = "=inc_segN/appr_apps" End Select Me.Calculate Application.EnableEvents = True End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this out to see for yourself..........
open a blank workbook. type some text or numbers in a column, several rows down, such as 3829378 3829 482394 3827834 now you see above, that the undo arrow is lit up - you can use it. now open the vb editor, and paste in this code into that worksheet: Sub lets_see() Dim ws As Worksheet Set ws = ActiveSheet ws.Range("a2") = "Patty Smith" End Sub run the code (from the vba editor). now switch back to the worksheet. Patty Smith is now in A2, and the undo button is disabled. you can no longer undo entering those numbers. type more numbers, and the undo button becomes enabled again. :) hope this helps susan |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Susan /Tom,
Thank you so much for explaining this to me.I have realised since my macro is in Worksheet_Calculate event its running each time I do any thing on Worksheet and ultimately hiding the Undo button. As you can realise that although I obtain the desied metric correct by writing the macro its creating another trouble where users can not undo their actions.For exaample if they bring down the Page field in the row they can not undo it and to get the normal Pivot they have to close it and then open it again. Do you have some solution where I can get the correct metric and at the sam time have the mormal Excel features working. Regards, Shailesh |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
shailesh -
nope, sorry. i can explain it, but i have no idea how to get around it. maybe tom has an answer. :) susan On Apr 26, 11:12 pm, Shailesh wrote: Susan /Tom, Thank you so much for explaining this to me.I have realised since my macro is in Worksheet_Calculate event its running each time I do any thing on Worksheet and ultimately hiding the Undo button. As you can realise that although I obtain the desied metric correct by writing the macro its creating another trouble where users can not undo their actions.For exaample if they bring down the Page field in the row they can not undo it and to get the normal Pivot they have to close it and then open it again. Do you have some solution where I can get the correct metric and at the sam time have the mormal Excel features working. Regards, Shailesh |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Susan.Tom , Could you please take call?
Regards, Shailesh |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Undo, redo buttons always grayed out | Excel Worksheet Functions | |||
undo and redo do not work | Excel Worksheet Functions | |||
undo/redo action | Excel Discussion (Misc queries) | |||
Undo Redo Reset Buttons | Excel Programming | |||
Highlighting a cell, and undo and redo buttons | Excel Programming |