Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting Rows...but losing "FORMAT" FLKULCHAR Excel Discussion (Misc queries) 1 March 23rd 10 03:14 AM
Inserting Auto Text for "Last Printed On" Date indeecee Excel Discussion (Misc queries) 1 August 26th 09 04:47 PM
"Cannot shift objects off sheet" in Excel when inserting row/col? NICOLAS.K. Excel Worksheet Functions 2 February 23rd 09 05:01 PM
When inserting column I get "cannot shift object off sheet" Oz Excel Worksheet Functions 1 August 25th 08 01:24 PM
inserting a conditional "go to" command on a excel "if" function velasques Excel Worksheet Functions 5 March 10th 06 08:16 PM


All times are GMT +1. The time now is 05:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"