Copy Paste Formulas

MrGJEB

New Member
Joined
Jun 13, 2008
Messages
37
Hi,

Is it possible to use VB code to copy a row and paste only the formulas and cell formats to the next row. I dont want the values to be pasted.

Many Thanks

Grant
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi Grant

using VBA, the following is an example:

Code:
Sub example()
With ActiveCell
    .Copy
    .PasteSpecial xlFormulas
    .PasteSpecial xlFormats
End With
End Sub

Assumes you want to copy formula and ALL formats...
 
Upvote 0
This copies the formula and formats but also the values. I do not want to copy the values of the cells.

Any help
 
Upvote 0
Do you mean:

1. If the cell has a formula then copy the cell and paste formula and cell formats?
2. If the cell has a constant then copy the cell and paste only formats?
 
Upvote 0
i have found it.

after your code i have inserted the line:

Selection.cells.specialcells(xlcelltypeconstants).clearcontents

It seems to be working now.

Thanks for your help
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,725
Members
448,987
Latest member
marion_davis

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