speech marks in VB formula

C

camron107

I have a formula i want VB to write into a cell i specify.

the only problem is, the formula has " in it... >>

ActiveCell.Offset(0, 8) = "=IF(LEFT(C2122) = "T", "N/A", IF(LEFT(C2122) = "V","N/A",HYPERLINK(("\\Gscc1\Rugby\Registration\Databases\Signatures\" &TEXT('Organisations A-F'!J2122,"00000")), "Signature of")))"

the two speech marks on the outsides of the formula interrupt with the speech marks i have as part of my formula...

i recieve "expected: end of statement" at "T" because it finds the second speech mark there... is there any way i can isolate the formula so it does not interfere?

thank you for your help
 
I

Ian

Where you want to actually use a ", put two in the code.

i.e. "=IF(LEFT(C2122) = ""T"", ""N/A"", ....etc
-----Original Message-----

I have a formula i want VB to write into a cell i specify.

the only problem is, the formula has " in it... >>

ActiveCell.Offset(0, 8) = "=IF(LEFT(C2122) = "T", "N/A",
IF(LEFT(C2122) = "V","N/A",HYPERLINK(("\\Gscc1
\Rugby\Registration\Databases\Signatures\" &TEXT
('Organisations A-F'!J2122,"00000")), "Signature of")))"
the two speech marks on the outsides of the formula
interrupt with the speech marks i have as part of my
formula...
i recieve "expected: end of statement" at "T" because it
finds the second speech mark there... is there any way i
can isolate the formula so it does not interfere?
 
D

Dave Peterson

I sometimes build long formulas in the cell I'm gonna use.

When I get it working, I copy it from the formula bar (at the top) and paste it
into my VBA code.

Then I go through and double up my quotes. " becomes "".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top