![]() |
cell.formula returns value
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? |
cell.formula returns value
Did you try
formulalocal or formular1c1 ? maybe one of those work. Are you sure, that D12 = D11 + D7? hth Carlo On Dec 18, 2:00 pm, 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? |
cell.formula returns value
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? |
cell.formula returns value
"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? |
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? |
cell.formula returns value
thanks for posting back and letting us know you found the problem
"Gleam" wrote: 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? |
All times are GMT +1. The time now is 12:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com