Tweek Paste Code (VBA)?

Mister H

Well-known Member
Joined
Mar 6, 2002
Messages
1,507
Hi:

Hopefully this is a simple process. I am using the following code in a Macro to paste some data.

Code:
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False


When I originally requested this code I only needed to copy the formatting however I have since added in formulas that are alos required. Can you PasteSpecial more then one option? Does this make sense? I need to paste the formatting but also some formulas? I assume if I Paste Special the formulas the formatting will not be pasted?

THANKS to any that can guide me,
Mark
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

jss1234

Active Member
Joined
May 28, 2004
Messages
434
Code:
Selection.PasteSpecial Paste:=xlFormulas
Selection.PasteSpecial Paste:=xlFormats

This will first paste formats, then paste formulas - 2 lines of code, but you already copied the data and set the past range
 

Mister H

Well-known Member
Joined
Mar 6, 2002
Messages
1,507
THANKS... Excuse my VBA ignorance but do I just paste the

Selection.PasteSpecial Paste:=xlFormulas after the xlFormats?

eg.

Code:
Selection.PasteSpecial Paste:=xlFormats, Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _ 
        False, Transpose:=False

The above is just part of the code I am using but it is the part that Pastes the selection.

THANKS Again,
Mark
 

jss1234

Active Member
Joined
May 28, 2004
Messages
434
I re-ordered the code above - just replace the original code you had with the code I provided, and it should work
 

Forum statistics

Threads
1,141,844
Messages
5,708,928
Members
421,599
Latest member
santosh234

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top