View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Syntax error while applying a formula in a macro

You have to double up the double quotes:

myFormula = _
"=IF(LEFT(CELL(""format"",RC[1]),1)=""D""," _
& "RC[1],DATE(LEFT(RC[1],4),MID(RC[1],5,2),RIGHT(RC[1],2)))"

'then .formular1c1
activecell.formular1c1 = myformula



pol wrote:

Sorry for reposting this question again.

I am getting an error message ' syntax error' while applying the formula in
a macro. This formula is using to convert the date from a string . But it
will work when I am applying the formula directly in a formula bar

myFormula =
"=IF(LEFT(CELL("format",RC[1]),1)="D",RC[1],DATE(LEFT(RC[1],4),MID(RC[1],5,2),RIGHT(RC[1],2)))"

With thanks and regards

Polachan

Please help


--

Dave Peterson