Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default formula error, vba not liking commas


I am trying to put the following formula into a piece of code (using the
variable 'sFormula' to hold the formula) and get the error message as below,
any ideas how i can get around this. I know i could place it on the
worksheet somewhere and copy it but would like to keep it in code if possible

sFormula="=IF(LEFT(RIGHT(A7,2),1)=",","."&RIGHT(A7 ,1),"")"

"Compile error expected end of statement"

it appears not to like the first comma in inverted commas

Any ideas will be gratefully received
--
with kind regards

Spike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default formula error, vba not liking commas

Within string literals, double quotes mus be doubled:
sFormula="=IF(LEFT(RIGHT(A7,2),1)="","","".""&RIGH T(A7,1),"""""")"

HTH
--
AP
"Spike" a écrit dans le message de
...

I am trying to put the following formula into a piece of code (using the
variable 'sFormula' to hold the formula) and get the error message as

below,
any ideas how i can get around this. I know i could place it on the
worksheet somewhere and copy it but would like to keep it in code if

possible

sFormula="=IF(LEFT(RIGHT(A7,2),1)=",","."&RIGHT(A7 ,1),"")"

"Compile error expected end of statement"

it appears not to like the first comma in inverted commas

Any ideas will be gratefully received
--
with kind regards

Spike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default formula error, vba not liking commas

sFormula = "=IF(LEFT(RIGHT(A7,2),1)="","","".""&RIGHT(A7,1)," """)"

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Spike" wrote in message
...

I am trying to put the following formula into a piece of code (using the
variable 'sFormula' to hold the formula) and get the error message as

below,
any ideas how i can get around this. I know i could place it on the
worksheet somewhere and copy it but would like to keep it in code if

possible

sFormula="=IF(LEFT(RIGHT(A7,2),1)=",","."&RIGHT(A7 ,1),"")"

"Compile error expected end of statement"

it appears not to like the first comma in inverted commas

Any ideas will be gratefully received
--
with kind regards

Spike



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default formula error, vba not liking commas

Thank you both of you, much appreciated

You learn something new every day!!
--
with kind regards

Spike


"Spike" wrote:


I am trying to put the following formula into a piece of code (using the
variable 'sFormula' to hold the formula) and get the error message as below,
any ideas how i can get around this. I know i could place it on the
worksheet somewhere and copy it but would like to keep it in code if possible

sFormula="=IF(LEFT(RIGHT(A7,2),1)=",","."&RIGHT(A7 ,1),"")"

"Compile error expected end of statement"

it appears not to like the first comma in inverted commas

Any ideas will be gratefully received
--
with kind regards

Spike

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default formula error, vba not liking commas

If you don't double up on the quotes, it thinks the first one is the end of
the string and then gets confused by what follows <g

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Spike" wrote in message
...
Thank you both of you, much appreciated

You learn something new every day!!
--
with kind regards

Spike


"Spike" wrote:


I am trying to put the following formula into a piece of code (using the
variable 'sFormula' to hold the formula) and get the error message as

below,
any ideas how i can get around this. I know i could place it on the
worksheet somewhere and copy it but would like to keep it in code if

possible

sFormula="=IF(LEFT(RIGHT(A7,2),1)=",","."&RIGHT(A7 ,1),"")"

"Compile error expected end of statement"

it appears not to like the first comma in inverted commas

Any ideas will be gratefully received
--
with kind regards

Spike





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
How to add commas to the result of a formula with a text operator? jlrichman Excel Discussion (Misc queries) 3 April 22nd 23 04:08 AM
Formula to Add $ and/or commas Outlook, eh? Excel Worksheet Functions 5 August 13th 07 07:34 PM
Help! I need a formula to add numbers separated by commas within SUPER EA Excel Worksheet Functions 8 July 27th 07 06:24 PM
formula to count commas Janis Excel Discussion (Misc queries) 4 July 19th 07 06:56 PM
Autoselection of Spreadsheet for liking Spreadsheet Linking Flexibility Excel Discussion (Misc queries) 0 May 29th 06 07:19 PM


All times are GMT +1. The time now is 07:12 AM.

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"