Yugal Jindle
Yugal Jindle

Reputation: 45646

How to replace formula with value in cell using vb.net?

I have complex formula calculating the value of a cell and it calculates the value for me.

I want to get rid of the formula from the cell and want to retain the calculated value.

I have :

Dim range As Excel.Range = getRange()
For Each cell in range
    ' What should do to retain the value and get rid of the formula in the cell.
Next cell

Upvotes: 0

Views: 1844

Answers (2)

MikeD
MikeD

Reputation: 8941

If a VBA doesn't pay off, try

  • pressing F2 (edit) F9 (calculate) ENTER (save value) for a single cell
  • copy a range and PasteSpecial/Values onto itself for larger ranges

Upvotes: 0

JMax
JMax

Reputation: 26591

What about:

For Each cell in range
   cell.Value = cell.Value
Next cell

Upvotes: 3

Related Questions