Problems with quotes

G

Guest

Can some one please show me the proper syntax for this:

ActiveCell.Formula = "=IF(A1=0,,(TEXT(A1, 'mm-yy-dd' )& '-' & ROW(A1)))"

With single quotes inside double quotes, the function returns a '1004'
defined error, with double - double quotes the compliler returns an error.

The formula works correctly when typed directly into the cell.

The result of the formula should be 10-29-04-1 if the date in A1 is 10/29/04
and blank otherwise.
 
H

Harald Staff

Hi

One quote is two quotes in code.

ActiveCell.Formula = "=IF(A1=0,"""",(TEXT(A1,""mm-yy-dd"")&""-""& ROW(A1)))"

HTH. Best wishes Harald
 
G

Guest

Thank you, sir. Much appreciated.

Harald Staff said:
Hi

One quote is two quotes in code.

ActiveCell.Formula = "=IF(A1=0,"""",(TEXT(A1,""mm-yy-dd"")&""-""& ROW(A1)))"

HTH. Best wishes Harald
 

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