2011-07-26 77 views
1

我有一個複雜的公式計算單元格的值,它爲我計算出的值。如何用vb.net替換單元格中的值? (Excel)

我想擺脫單元格中的公式,並希望保留計算的值。

我:

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 

請幫助..它非常緊迫!

它使我堅果..!

+0

是一個重複的問題: http://stackoverflow.com/questions/6844444/how-to-optimize-this-simple-but-horrible-implementation/ – Alen

回答

3

什麼:

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

如果VBA沒有還清,儘量

  • F2(編輯)F9(計算)ENTER(保存值)對於單個單元格
  • 將範圍和PasteSpecial/Values複製到較大範圍本身
相關問題