Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Array match in VBA

Is there a way to implement such a statement in VBA ?

{=MATCH(1;(R_CODES=C_SEARCHCODE)*(R_FROM<=C_SEARCH DATE);0)}

This works in a cell but I need to create a VBA function that retrieves a
value based on arguments and use it in a subroutine.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Array match in VBA

v = Evaluate("MATCH(1,(R_CODES=C_SEARCHCODE)*(R_FROM<= C_SEARCHDATE),0)"

--
Regards,
Tom Ogilvy

"DoctorG" wrote:

Is there a way to implement such a statement in VBA ?

{=MATCH(1;(R_CODES=C_SEARCHCODE)*(R_FROM<=C_SEARCH DATE);0)}

This works in a cell but I need to create a VBA function that retrieves a
value based on arguments and use it in a subroutine.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Array match in VBA

That simple????..... Thanks Tom

"Tom Ogilvy" wrote:

v = Evaluate("MATCH(1,(R_CODES=C_SEARCHCODE)*(R_FROM<= C_SEARCHDATE),0)"

--
Regards,
Tom Ogilvy

"DoctorG" wrote:

Is there a way to implement such a statement in VBA ?

{=MATCH(1;(R_CODES=C_SEARCHCODE)*(R_FROM<=C_SEARCH DATE);0)}

This works in a cell but I need to create a VBA function that retrieves a
value based on arguments and use it in a subroutine.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Array match in VBA

IShould be - almost, I left off the closing paren:

v = Evaluate("MATCH(1,(R_CODES=C_SEARCHCODE)*(R_FROM<= C_SEARCHDATE),0)")

and I am pretty sure that it should be entered as a US English syntax -
although I don't have a foreign version to test with. Test it with some
simple formulas and see what it will accept. Evaluate is like a virtual
cell. Most things that will work in a cell will work with evaluate if that
sheet is active - including array formulas.

--
Regards,
Tom Ogilvy



"DoctorG" wrote:

That simple????..... Thanks Tom

"Tom Ogilvy" wrote:

v = Evaluate("MATCH(1,(R_CODES=C_SEARCHCODE)*(R_FROM<= C_SEARCHDATE),0)"

--
Regards,
Tom Ogilvy

"DoctorG" wrote:

Is there a way to implement such a statement in VBA ?

{=MATCH(1;(R_CODES=C_SEARCHCODE)*(R_FROM<=C_SEARCH DATE);0)}

This works in a cell but I need to create a VBA function that retrieves a
value based on arguments and use it in a subroutine.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Array match in VBA

Tom, Evaluate worked but I had to construct the string embedding the actual
values:

evaluate_string = "MATCH(1,(R_CODES=" & search_code & ")*(R_FROM<=" &
search_date & "),0)"
result = Evaluate(evaluate_string)

Otherwise I would get a 2042 error, obviously something to do with the scope
of the variables used.

Thanks a lot!!

"Tom Ogilvy" wrote:

IShould be - almost, I left off the closing paren:

v = Evaluate("MATCH(1,(R_CODES=C_SEARCHCODE)*(R_FROM<= C_SEARCHDATE),0)")

and I am pretty sure that it should be entered as a US English syntax -
although I don't have a foreign version to test with. Test it with some
simple formulas and see what it will accept. Evaluate is like a virtual
cell. Most things that will work in a cell will work with evaluate if that
sheet is active - including array formulas.

--
Regards,
Tom Ogilvy



"DoctorG" wrote:

That simple????..... Thanks Tom

"Tom Ogilvy" wrote:

v = Evaluate("MATCH(1,(R_CODES=C_SEARCHCODE)*(R_FROM<= C_SEARCHDATE),0)"

--
Regards,
Tom Ogilvy

"DoctorG" wrote:

Is there a way to implement such a statement in VBA ?

{=MATCH(1;(R_CODES=C_SEARCHCODE)*(R_FROM<=C_SEARCH DATE);0)}

This works in a cell but I need to create a VBA function that retrieves a
value based on arguments and use it in a subroutine.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Array match in VBA

I had no way of knowing whether those were variables or defined names. If
defined names, as I wrote it would be good. If they are variables used in
your code, then what you say is true. However, if I had posted a question
and said:


-----------------------------------------------------------
Is there a way to implement such a statement in VBA ?

{=MATCH(1;(R_CODES=C_SEARCHCODE)*(R_FROM<=C_SEARCH DATE);0)}

------------------------------------------------------------

What do you think you would think SearchCode and C_SearchDate were?

Not complaining, but just to point out something you should consider if you
post future questions.

--
Regards,
Tom Ogvily



..
"DoctorG" wrote in message
...
Tom, Evaluate worked but I had to construct the string embedding the
actual
values:

evaluate_string = "MATCH(1,(R_CODES=" & search_code & ")*(R_FROM<=" &
search_date & "),0)"
result = Evaluate(evaluate_string)

Otherwise I would get a 2042 error, obviously something to do with the
scope
of the variables used.

Thanks a lot!!

"Tom Ogilvy" wrote:

IShould be - almost, I left off the closing paren:

v = Evaluate("MATCH(1,(R_CODES=C_SEARCHCODE)*(R_FROM<= C_SEARCHDATE),0)")

and I am pretty sure that it should be entered as a US English syntax -
although I don't have a foreign version to test with. Test it with some
simple formulas and see what it will accept. Evaluate is like a virtual
cell. Most things that will work in a cell will work with evaluate if
that
sheet is active - including array formulas.

--
Regards,
Tom Ogilvy



"DoctorG" wrote:

That simple????..... Thanks Tom

"Tom Ogilvy" wrote:

v =
Evaluate("MATCH(1,(R_CODES=C_SEARCHCODE)*(R_FROM<= C_SEARCHDATE),0)"

--
Regards,
Tom Ogilvy

"DoctorG" wrote:

Is there a way to implement such a statement in VBA ?

{=MATCH(1;(R_CODES=C_SEARCHCODE)*(R_FROM<=C_SEARCH DATE);0)}

This works in a cell but I need to create a VBA function that
retrieves a
value based on arguments and use it in a subroutine.



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
MATCH() on a 2D array? Geoff Lambert Excel Discussion (Misc queries) 7 April 25th 23 03:48 AM
Match using array of column and row references to match with jkfin1 Excel Worksheet Functions 1 September 16th 08 04:39 PM
Match & array Carmen Excel Worksheet Functions 2 July 31st 07 04:08 AM
index match array function-returning only first match, need last. Julie Olsen Excel Worksheet Functions 3 December 29th 06 12:50 AM
Match as well as does not match array function Vikram Dhemare Excel Discussion (Misc queries) 7 April 25th 06 09:15 AM


All times are GMT +1. The time now is 04:50 AM.

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"