Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
pol pol is offline
external usenet poster
 
Posts: 129
Default Syntax error while applying a formula in a macro

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






  #2   Report Post  
Posted to microsoft.public.excel.misc
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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Syntax error while applying a formula in a macro

Your quotation marks need to be doubled up to indicate that the string
actually contains quotation marks and that it is not the end of the string...

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)))"

--
HTH...

Jim Thomlinson


"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






  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Syntax error while applying a formula in a macro

Hi,

I have a suggestion for avoiding this problem in the futu

1. enter the formula in the spreadsheet and with your cursor on that cell
2. turn on the macro recorder
3. press F2, Enter
4. turn the recorder off

If this helps, please click the Yes button

Cheers,
Shane Devenshire

"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






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
Syntax error Neil Pearce Excel Discussion (Misc queries) 4 November 21st 08 04:55 PM
syntax error - help Jim May Excel Discussion (Misc queries) 2 August 23rd 07 09:08 PM
COUNTA function causing syntax error in macro... Birmangirl Excel Worksheet Functions 4 February 6th 07 04:04 PM
Formula syntax error - chinese and gibberish Joshua Fandango Excel Discussion (Misc queries) 3 March 29th 05 01:27 PM
Vlookup Syntax Error YV New Users to Excel 9 December 23rd 04 05:28 PM


All times are GMT +1. The time now is 10:23 PM.

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

About Us

"It's about Microsoft Excel"