Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Formula with quotes and ampersand

Hi!,

I am having trouble trying to enter this fromula in a cell using VBA, I keep
getting a message Type Mismatch.
I have tried Double quotes and also quotes around the ampersand but I am
still doing something wrong, I hope someone can help me out.

Range("I3").Formula = "=INDEX('[ENGINEER
CODES.xls]Sheet1'!$G$3:$G$216,MATCH("*"&$C3&"*",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))"

The quotes and ampersands are needed in the formula.


Thanks
Neil


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Formula with quotes and ampersand

Neil,

Try

Range("I3").Formula = "=INDEX('[ENGINEER
CODES.xls]Sheet1'!$G$3:$G$216,MATCH("" * ""&$C3&"" * "",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Neil" wrote in message
...
Hi!,

I am having trouble trying to enter this fromula in a cell using VBA, I

keep
getting a message Type Mismatch.
I have tried Double quotes and also quotes around the ampersand but I am
still doing something wrong, I hope someone can help me out.

Range("I3").Formula = "=INDEX('[ENGINEER
CODES.xls]Sheet1'!$G$3:$G$216,MATCH("*"&$C3&"*",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))"

The quotes and ampersands are needed in the formula.


Thanks
Neil




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formula with quotes and ampersand

Just a heads up:

That produces =INDEX('[ENGINEER CODES.xls]Sheet1'!$G$3:$G$216,MATCH(" *
"&$C3&" * ",'[ENGINEER CODES.xls]Sheet1'!$F$3:$F$216,0))

so if C3 contained the characters BC, the item looked for would be " * BC *
" which I don't think was the original intent and wouldn't find ABCD for
example.


"=INDEX('[ENGINEER
CODES.xls]Sheet1'!$G$3:$G$216,MATCH(""*""&$C3&""*"",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))"

produces:
=INDEX('[ENGINEER CODES.xls]Sheet1'!$G$3:$G$216,MATCH("*"&$C3&"*",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))

--
Regards,
Tom Ogilvy


Bob Phillips wrote in message
...
Neil,

Try

Range("I3").Formula = "=INDEX('[ENGINEER
CODES.xls]Sheet1'!$G$3:$G$216,MATCH("" * ""&$C3&"" * "",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Neil" wrote in message
...
Hi!,

I am having trouble trying to enter this fromula in a cell using VBA, I

keep
getting a message Type Mismatch.
I have tried Double quotes and also quotes around the ampersand but I am
still doing something wrong, I hope someone can help me out.

Range("I3").Formula = "=INDEX('[ENGINEER
CODES.xls]Sheet1'!$G$3:$G$216,MATCH("*"&$C3&"*",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))"

The quotes and ampersands are needed in the formula.


Thanks
Neil






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Formula with quotes and ampersand

Tom/Bob,

Thanks for your help, Tom's code was what I required. In the meantime I got
around it by putting the formula in another sheet and then just copied the
formula when it was required.

Once again thanks for your help.

Regards
Neil

"Tom Ogilvy" wrote in message
...
Just a heads up:

That produces =INDEX('[ENGINEER CODES.xls]Sheet1'!$G$3:$G$216,MATCH(" *
"&$C3&" * ",'[ENGINEER CODES.xls]Sheet1'!$F$3:$F$216,0))

so if C3 contained the characters BC, the item looked for would be " * BC

*
" which I don't think was the original intent and wouldn't find ABCD

for
example.


"=INDEX('[ENGINEER
CODES.xls]Sheet1'!$G$3:$G$216,MATCH(""*""&$C3&""*"",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))"

produces:
=INDEX('[ENGINEER

CODES.xls]Sheet1'!$G$3:$G$216,MATCH("*"&$C3&"*",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))

--
Regards,
Tom Ogilvy


Bob Phillips wrote in message
...
Neil,

Try

Range("I3").Formula = "=INDEX('[ENGINEER
CODES.xls]Sheet1'!$G$3:$G$216,MATCH("" * ""&$C3&"" * "",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Neil" wrote in message
...
Hi!,

I am having trouble trying to enter this fromula in a cell using VBA,

I
keep
getting a message Type Mismatch.
I have tried Double quotes and also quotes around the ampersand but I

am
still doing something wrong, I hope someone can help me out.

Range("I3").Formula = "=INDEX('[ENGINEER
CODES.xls]Sheet1'!$G$3:$G$216,MATCH("*"&$C3&"*",'[ENGINEER
CODES.xls]Sheet1'!$F$3:$F$216,0))"

The quotes and ampersands are needed in the formula.


Thanks
Neil








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
change straight quotes to curly quotes callico Excel Discussion (Misc queries) 2 June 22nd 07 10:23 PM
Ampersand in Header SAL Excel Discussion (Misc queries) 1 April 14th 06 12:21 AM
ampersand in header EllenSeitz Excel Discussion (Misc queries) 1 February 9th 06 03:34 PM
using ampersand in the header does not appear Katydid Excel Discussion (Misc queries) 4 December 12th 05 10:24 PM


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

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

About Us

"It's about Microsoft Excel"