ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula within formula (https://www.excelbanter.com/excel-programming/290604-formula-within-formula.html)

Emma Hope[_3_]

Formula within formula
 
I think this is quite a simple one

i am using a macro to put a formula in a cell, however as it contains speech marks (") it does not work, is there a way to get it to understand the speechmarks within the outer speech marks are part of the formula i want typed in the cell

Worksheets("Customer Form").Range("C13").Formula = "=IF(Data!K11 = "New Manager", "Please Overtype With Name Of New Manager","")"

Tom Ogilvy

Formula within formula
 
"=IF(Data!K11 = ""New Manager"", ""Please Overtype With Name Of New
Manager"","""")"

verify in the immediate window:

? "=IF(Data!K11 = ""New Manager"", ""Please Overtype With Name Of New
Manager"","""")"
=IF(Data!K11 = "New Manager", "Please Overtype With Name Of New Manager","")

so a doubled speech marks within a string produce a single speech mark.

--
Regards,
Tom Ogilvy

Emma Hope wrote in message
...
I think this is quite a simple one,

i am using a macro to put a formula in a cell, however as it contains

speech marks (") it does not work, is there a way to get it to understand
the speechmarks within the outer speech marks are part of the formula i want
typed in the cell?

Worksheets("Customer Form").Range("C13").Formula = "=IF(Data!K11 = "New

Manager", "Please Overtype With Name Of New Manager","")"



John Wilson

Formula within formula
 
Emma,

Try this:

Worksheets("Customer Form").Range("C13").Formula = _
"=IF(Data!K11 = ""New Manager"", ""Please Overtype With Name Of New
Manager"","""")"


John

"Emma Hope" wrote in message
...
I think this is quite a simple one,

i am using a macro to put a formula in a cell, however as it contains

speech marks (") it does not work, is there a way to get it to understand
the speechmarks within the outer speech marks are part of the formula i want
typed in the cell?

Worksheets("Customer Form").Range("C13").Formula = "=IF(Data!K11 = "New

Manager", "Please Overtype With Name Of New Manager","")"



Emma Hope[_3_]

Formula within formula
 
Thanks Tom & John, that works great!!


All times are GMT +1. The time now is 11:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com