Paul, As you know I adhere closely to the KISS principle. I assumed ?? that OP 
wanted to “put the formula back” . 

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguille...@gmail.com

From: Paul Schreiner 
Sent: Wednesday, March 07, 2012 8:31 AM
To: excel-macros@googlegroups.com 
Subject: $$Excel-Macros$$ Re: modification in paste special macro.

First of all, you should NOT simply change the topic of somone else's 
discussion thread and ask your own question.
That's called "hijacking a thread", and is extremely bad form.

Secondly...
When you select a range of cells and copy/paste special -Values,
Excel does a bunch of stuff behind-the-scenes.
One thing it does is that it takes the current values and copies them to the 
"undo stack".
This stack list is displayed whenever you use the undo "pull-down".
You'll also notice that it operates in a last-in-first-out sequence. (the last 
thing you did is the first thing that can be reversed)
(in other programming environments, putting something on the stack is called a 
"push" to the stack,
and retrieving from the stack is called a "pop" from the stack)

When you created your macro, you effectively bypass making the entry into the 
"undo stack".
I haven't done much stack programming in a number of years (and never in Excel)
I'm not sure if you can manually push anything to the stack.

So.. Don's answer may be much more concise, as well as serving two purposes:
"No", you cannot push the pastespecial to the undo stack,
and "No", you should not use someone else's discussion thread for your own 
unrelated question.

Paul

On Tuesday, March 6, 2012 11:41:23 PM UTC-5, danial mansoor wrote:
  i used this macro and assigned it a shortcut key for my conveniance for paste 
special values,but i can not undo last actions is that possible to undo last 2 
actions after modification of this posible?
   
  is that possible to modify and get desired result and undo last 2 actions 
only? how is that possible?
   
  Sub daniyal()

  Application.ScreenUpdating = False
          On Error Resume Next
          Selection.HasFormula = Selection.PasteSpecial(xlPasteValues)
          Selection.NumberFormat = "#,##0.00"
          Application.CutCopyMode = False
  Application.ScreenUpdating = True
  End Sub





    

-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
 
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to