View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
jindon[_5_] jindon[_5_] is offline
external usenet poster
 
Posts: 1
Default Getting only value out of a formula


Hi

Just an example

Code:
--------------------

Sub test()
Dim r As Range
For Each r In Range("a1:a100")
If r.HasFormula Then
r.Value = r.Value
End If
Next
End Sub
--------------------


or

Code:
--------------------

Sub test2()
With ActiveSheet.Cells.SpecialCells(xlCellTypeFormulas)
.Value = .Value
End With
End Sub
--------------------


crusoe81 Wrote:
Hi

I have a formula in a cell, but i want only the result of the formula
for my macro. Is there a way for me to reference the value in the cell
e.g
Let say A1 contains "=1+1"
how can i get the value 2 from cell A1 from VBA



--
jindon
------------------------------------------------------------------------
jindon's Profile: http://www.excelforum.com/member.php...o&userid=13135
View this thread: http://www.excelforum.com/showthread...hreadid=375903