Copying and pasting without replacing conditional formatting

rjsnieg

New Member
Joined
Feb 1, 2022
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Here is a quick workaround that I have used successfully to get around Excel's conditional formatting reference issues when copying and pasting.

In my case I only need the values and comments. I copy the entire active cell, then "dump" the values and comments to an area well outside of my data. Once that is done, clear the origin cell contents and comments. Then we need to copy the "dumped" cell again.

The paste macro pastes the values and comments to the active cell then clears the "dump area".

Once the following code is in a module, assign keyboard shortcuts to the copy and paste macros and use these instead of the native copy and paste shortcuts.

Hope this helps somebody!

Sub copy()

Application.ScreenUpdating = False
ActiveCell.copy
' dump the values and comments before clearing the original cell (does not copy origin cell formatting)
ActiveCell.Offset(800, 0).PasteSpecial (xlPasteValues)
ActiveCell.PasteSpecial (xlPasteComments)
' clears the contents and comments of the origin cell (does not clear origin cell formatting)
ActiveCell.Offset(-800, 0).ClearComments
ActiveCell.Offset(-800, 0).ClearContents
' copys the new cell to the clipboard
ActiveCell.copy
Application.ScreenUpdating = True



End Sub

Sub paste()

ActiveCell.PasteSpecial (xlPasteValues)
ActiveCell.PasteSpecial (xlPasteComments)
'clears the range where the copy "dumped" the cell data
Range("D800:GC1200").Clear

End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,214,605
Messages
6,120,473
Members
448,967
Latest member
visheshkotha

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