![]() |
Inserting a formual with " in it
I want to insert a formula into a specific cell, something like
ActiveCell.FormulaR1C1 = "=EOMONTH (Now(), -1)" This works fine and gives me the last day of last month. But this doesn't work because of the " ActiveCell.FormulaR1C1 = "=Right("0000"&c3,4)" The formula has quotes in it, and the VB chokes as it expects only one set of quotes. --mike |
Inserting a formual with " in it
Hi Mike,
Try doubling the internal quotes: ActiveCell.FormulaR1C1 = "=Right(""0000"" & c3,4)" --- Regards, Norman "Mbt6" wrote in message . .. I want to insert a formula into a specific cell, something like ActiveCell.FormulaR1C1 = "=EOMONTH (Now(), -1)" This works fine and gives me the last day of last month. But this doesn't work because of the " ActiveCell.FormulaR1C1 = "=Right("0000"&c3,4)" The formula has quotes in it, and the VB chokes as it expects only one set of quotes. --mike |
Inserting a formual with " in it
I got a little closer....thanks....
now can I get past a vlookup ActiveCell.FormulaR1C1 = "=Right(""0000"" & c3,4)&Vlookup(e3,'Bank Lookup'$A$2:$B$8,2,False)" I think the ' in the worksheet name is hanging me up now. The first part worked just fine. "Norman Jones" wrote in message ... Hi Mike, Try doubling the internal quotes: ActiveCell.FormulaR1C1 = "=Right(""0000"" & c3,4)" --- Regards, Norman "Mbt6" wrote in message . .. I want to insert a formula into a specific cell, something like ActiveCell.FormulaR1C1 = "=EOMONTH (Now(), -1)" This works fine and gives me the last day of last month. But this doesn't work because of the " ActiveCell.FormulaR1C1 = "=Right("0000"&c3,4)" The formula has quotes in it, and the VB chokes as it expects only one set of quotes. --mike |
Inserting a formual with " in it
Hi Mike,
Try: ActiveCell.Formula = "=Right(""0000"" & c3,4) & " & _ "Vlookup(e3,'Bank Lookup'!$A2:$B$8,2)" --- Regards, Norman "Mbt6" wrote in message . .. I got a little closer....thanks.... now can I get past a vlookup ActiveCell.FormulaR1C1 = "=Right(""0000"" & c3,4)&Vlookup(e3,'Bank Lookup'$A$2:$B$8,2,False)" I think the ' in the worksheet name is hanging me up now. The first part worked just fine. "Norman Jones" wrote in message ... Hi Mike, Try doubling the internal quotes: ActiveCell.FormulaR1C1 = "=Right(""0000"" & c3,4)" --- Regards, Norman "Mbt6" wrote in message . .. I want to insert a formula into a specific cell, something like ActiveCell.FormulaR1C1 = "=EOMONTH (Now(), -1)" This works fine and gives me the last day of last month. But this doesn't work because of the " ActiveCell.FormulaR1C1 = "=Right("0000"&c3,4)" The formula has quotes in it, and the VB chokes as it expects only one set of quotes. --mike |
Inserting a formual with " in it
Hi Mike,
I failed to include your fourth VLookup parameter, so change: ActiveCell.Formula = "=Right(""0000"" & c3,4) & " & _ "Vlookup(e3,'Bank Lookup'!$A2:$B$8,2)" to: ActiveCell.Formula = "=Right(""0000"" & c3,4) & " & _ "Vlookup(e3,'Bank Lookup'!$A2:$B$8,2,False)" --- Regards, Norman |
All times are GMT +1. The time now is 11:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com