Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBA Match Equivalent

I am in the process of making things calculated by VBA in one of our
Excel projects that has grown. I have a Validation drop down box
containing a list called "Hinges" and if someone chooses hinge "DSEL"
how can I get VBA to return number 4 (which is the location on the
list given by the Match Function). This is crucial to us because we
need that number to look up things in other arrays.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA Match Equivalent

Use Match

myNum = WorksheetFunction.Match("DSel",Range("A1:A20"),0)
If myNum = 0 Then
MsgBox "Not found"
End If

--

HTH

RP

"Network Admin" wrote in message
om...
I am in the process of making things calculated by VBA in one of our
Excel projects that has grown. I have a Validation drop down box
containing a list called "Hinges" and if someone chooses hinge "DSEL"
how can I get VBA to return number 4 (which is the location on the
list given by the Match Function). This is crucial to us because we
need that number to look up things in other arrays.

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default VBA Match Equivalent

With application.worksheetfunction.match, if there is not a match, you'll get a
run time error.

maybe:

dim res as variant
res = application.match("dsel",worksheets("sheet1").rang e("a1:a20"),0)
if iserror(res) then
'no match
else
msgbox res
end if

Application.match (w/o the worksheetfunction) will return an error that can be
checked later.



Bob Phillips wrote:

Use Match

myNum = WorksheetFunction.Match("DSel",Range("A1:A20"),0)
If myNum = 0 Then
MsgBox "Not found"
End If

--

HTH

RP

"Network Admin" wrote in message
om...
I am in the process of making things calculated by VBA in one of our
Excel projects that has grown. I have a Validation drop down box
containing a list called "Hinges" and if someone chooses hinge "DSEL"
how can I get VBA to return number 4 (which is the location on the
list given by the Match Function). This is crucial to us because we
need that number to look up things in other arrays.

Thanks


--

Dave Peterson

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
EQUIVALENT for this FORMULA , please ytayta555 Excel Worksheet Functions 1 July 3rd 08 10:25 PM
Function Equivalent need ytayta555 Excel Worksheet Functions 6 May 7th 08 02:53 PM
Equivalent of Alt+Tab for going between worksheets? Jonathan Excel Discussion (Misc queries) 2 May 6th 08 10:29 PM
VBA equivalent for worksheet 'match'? George[_3_] Excel Discussion (Misc queries) 2 April 20th 07 10:52 PM
Equivalent of Match Functn in VBA blueshot Excel Programming 2 December 22nd 03 07:09 AM


All times are GMT +1. The time now is 09:04 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"