And I agree with you. I have actually written projects to restore ALL formulas 
with macros on open because a user was always destroying somehow and insisted 
on not having them protected...... 
range(“c2:c22”).formula=”=a2+b2”

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

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

Don,

Oh, I agree completely!
However, depending on the experience level of the person asking the question,
it may not be enough to know that you CAN'T do it.
Personally, I'd need to know WHY.
There's been far too many times that someone has said (to me or others) that 
something
can't be done simply because they haven't been able to do it.

In fact, I'm a firm believer that ANYTHING can be done.
All it takes is time and money.

If I were told that something cannot be done, then I'd simply keep looking for 
another way to do the same thing.
If I were told WHY it cannot be done, then I may decide that the time (and 
money) required to do it isn't worth the effort.

For example:

If it were REALLY important that I be able to do what he's asking, 
then I'd build my own "undo stack".
Either virtually, or within the application.
For instance, in his macro I'd use a hidden sheet to store the Range's current 
formulas,
then do the PasteSpecial.
If I needed to "undo" it, then I'd use a macro to restore the formulas.
This would be a single-step undo, I wouldn't be able to go back several steps.
To do multi-levels, I'd have to either use multiple sheets, or look into 
virtual multi-dimensional arrays.

But then again, I'd REALLY have to want to do it (or someone pay me enough to 
REALLY want to do it)
 
Paul

-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




--------------------------------------------------------------------------------
From: dguillett1 <dguille...@gmail.com>
To: excel-macros@googlegroups.com
Sent: Wed, March 7, 2012 9:48:44 AM
Subject: Re: $$Excel-Macros$$ Re: modification in paste special macro.


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

-- 
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