View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
David Wakeling David Wakeling is offline
external usenet poster
 
Posts: 1
Default change cell value, but keep formula

Hello,
Could someone tell me how to change the value
of a cell, without also changing the formula?
The following code illustrates my problem:

Dim r As Range
Application.EnableEvents = False
Set r = Range("A1")
r.Formula = "= 42 / 100000"
r.Value = "negligible"
MsgBox "r.Formula = " & r.Formula & ", r.Value = " & r.Value
Application.EnableEvents = True

Assignment to the value seems to destroy the formula.

Many thanks,

David Wakeling