I have formulas and I would like to copy paste the values but still keep the calculation… instead of A1+A1 and A1 and A1 and A1 is 5 and the formula would give a 10 and that value is what you get when doing a copy and paste values. But I would like to paste value for each link. In my example it would be 5+5 as the formula in the cell Is this even possible?
Assistant
Yes, what you're asking for is possible — thoughnot directly with regular copy-paste. What you want is to replace each cell referencewith its current value, while keeping thestructure of the formula intact. So=A1+A1whereA1=5becomes=5+5.
This is not possible with basic Excel functionality like "Paste Values", but itcan be done using a macro or formula transformation script.
✅ Option 1: Use VBA to Replace Cell References with Their Values
You can use the following VBA macro to replace allcell referencesin a formula with theircurrent values:
vbaCopySub ReplaceReferencesWithValues()
Dim cell As Range
Dim formulaParts() As String
Dim i As Long
Dim f As String
code
For Each cell In Selection
If cell.HasFormula Then
f = cell.Formula
Dim rng As Range
For Each rng In cell.Precedents
f = Replace(f, rng.Address(False, False), rng.Value)
Next rng
cell.Formula = "=" & f
End If
Next cell
End Sub
How to use:
PressAlt + F11to open the VBA editor.
Insert a new Module (Insert>Module) and paste the code.
Close the editor.
In Excel, select the cells you want to transform.
PressAlt + F8, chooseReplaceReferencesWithValues, and run it.
PressAlt + F11to open the VBA editor.
Insert a new Module (Insert>Module) and paste the code.
Close the editor.
In Excel, select the cells you want to transform.
PressAlt + F8, chooseReplaceReferencesWithValues, and run it.