Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default UNDO and REDO buttons are inactive

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default UNDO and REDO buttons are inactive

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default UNDO and REDO buttons are inactive

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default UNDO and REDO buttons are inactive

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default UNDO and REDO buttons are inactive

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default UNDO and REDO buttons are inactive

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default UNDO and REDO buttons are inactive

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default UNDO and REDO buttons are inactive

Thanks Susan.Tom , Could you please take call?

Regards, Shailesh

Reply
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
Undo, redo buttons always grayed out Karl Excel Worksheet Functions 3 August 9th 07 09:35 PM
undo and redo do not work CidsUprite Excel Worksheet Functions 4 May 11th 07 03:15 AM
undo/redo action dmuraki Excel Discussion (Misc queries) 3 November 30th 04 12:11 AM
Undo Redo Reset Buttons Richard[_17_] Excel Programming 1 September 6th 03 04:09 AM
Highlighting a cell, and undo and redo buttons John[_35_] Excel Programming 1 July 29th 03 01:33 PM


All times are GMT +1. The time now is 12:33 PM.

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

About Us

"It's about Microsoft Excel"