View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gleam Gleam is offline
external usenet poster
 
Posts: 87
Default cell.formula returns value

Thank you for the ideas. It turned out that deleting blank rows below the row
in question turned the formula into a value, before it ever got to the bit of
code I posted. I have found another way of acheiving what I wanted when
deleting rows, so problem is resolved. Many thanks.

"JMB" wrote:

Since Cells(12,"D") refers to the activesheet, are you sure the sheet
containing the formula "=D11+D7" is the active sheet??

If it is possible the sheet you want may not be the active sheet when the
macro runs, you could fully qualify your reference
Sheets("SheetName").Cells(12, "D").Formula





"Gleam" wrote:

I have this line of code:
MyStr = Cells(12 , "D").Formula

I expect it to return "=D11 + D7" but it reurns the the value Cells(12 ,
"D").Value

How do I get the formula?