ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba for paste special (https://www.excelbanter.com/excel-programming/371202-vba-paste-special.html)

Chris

vba for paste special
 
Hi everyone - hope you can help

Is there any way to tweak the code to paste Values and Formulas and thats
all

can't get the code to allow multiple criteria, I don't want the formatting
just the values and formulas


PasteSpecial Paste:=xlPasteFormulasAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False



Dave Peterson

vba for paste special
 
You could do it twice

somerange.pastespecial paste:=xlpasteformulas
somerange.pastespecial paste:=xlpasteFormats

One right after the other.

You didn't really mean values, right?




Chris wrote:

Hi everyone - hope you can help

Is there any way to tweak the code to paste Values and Formulas and thats
all

can't get the code to allow multiple criteria, I don't want the formatting
just the values and formulas

PasteSpecial Paste:=xlPasteFormulasAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False


--

Dave Peterson

Chris

vba for paste special
 
yes , I ment values and formulas

the sheet I am pasting from has both keyed info(values) and formulas for
totaling and other functions with the info

after pasting additional math is preformed on different parts

two different people have access to this sheet and if a number accidently
get changed you can't tell because the formulas aren't there anymore and the
end result never changes

I would rather the formulas remain intact so if a number gets changed it
would reflect in one of the totals amt and the error could be corrected

sheet has 500+ lines - easier to spot check a few totaled areas

Thanks at least I have an idea now to try - paste values first and then
again with the formulas

"Dave Peterson" wrote in message
...
You could do it twice

somerange.pastespecial paste:=xlpasteformulas
somerange.pastespecial paste:=xlpasteFormats

One right after the other.

You didn't really mean values, right?




Chris wrote:

Hi everyone - hope you can help

Is there any way to tweak the code to paste Values and Formulas and thats
all

can't get the code to allow multiple criteria, I don't want the
formatting
just the values and formulas

PasteSpecial Paste:=xlPasteFormulasAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False


--

Dave Peterson




Dave Peterson

vba for paste special
 
If you protect the cells with the formulas (and values you don't want changed)
and unprotect the cells that should be able to be changed
(format|cells|protection tab), then protect the worksheet (tools|protect|protect
sheet), then the problem may go away.

But if you copy|paste special|Formulas, both formulas and constants get pasted.

===
I guess I don't understand where you're getting the formulas to restore and
how/when you're going to copy them.

Chris wrote:

yes , I ment values and formulas

the sheet I am pasting from has both keyed info(values) and formulas for
totaling and other functions with the info

after pasting additional math is preformed on different parts

two different people have access to this sheet and if a number accidently
get changed you can't tell because the formulas aren't there anymore and the
end result never changes

I would rather the formulas remain intact so if a number gets changed it
would reflect in one of the totals amt and the error could be corrected

sheet has 500+ lines - easier to spot check a few totaled areas

Thanks at least I have an idea now to try - paste values first and then
again with the formulas

"Dave Peterson" wrote in message
...
You could do it twice

somerange.pastespecial paste:=xlpasteformulas
somerange.pastespecial paste:=xlpasteFormats

One right after the other.

You didn't really mean values, right?




Chris wrote:

Hi everyone - hope you can help

Is there any way to tweak the code to paste Values and Formulas and thats
all

can't get the code to allow multiple criteria, I don't want the
formatting
just the values and formulas

PasteSpecial Paste:=xlPasteFormulasAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 01:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com