Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've hacked merrily along with this, but following values in Watch, it
appears I have failed to understand it correctly. Here's what I have: v = Array("PEN-Pensionalble Earnings", _ "PN2-Pension Plan Charlotte Hly HN2", _ "TSP-Textron Savings Plan") res = Application.Match(rngCell.Value, v, 0) and when rngCell.Value = "PEN-Pensionalble Earnings", it is returning an error. I also tried it just using the form in your example of res = Application.Match(rng, v, 0) and got the same result. Where did I go wrong, mother darling? -- Dave Temping with Staffmark in Rock Hill, SC "Tom Ogilvy" wrote: No Inlist or equivalent command. One way: Dim v as Variant, res as Variant v = Array("PEN-Pensionalble Earnings", _ "PN2-Pension Plan Charlotte Hly HN2", _ "TSP-Textron Savings Plan") res = Application.Match(rng,v,0) if not iserror(res) then ' matches item in the list end if You can add to the list. If res isn't an error value, then you can use v(res) to tell you which it matched. -- Regards, Tom Ogilvy "Dave Birley" wrote: In VFP there is a Function called InList() where you may build an If-EndIf expression around a list of candidates. At the moment, in a Macro, I have this: If rngCell.Value = "PEN-Pensionable Earnings" Or _ rngCell.Value = "PN2-Pension Plan Charlotte Hly HN2" Or _ rngCell.Value = "TSP-Textron Savings Plan" Then However, on examining my data I discover that there are perhaps another DOZEN possible candidates. Do I have to continue building that horrendous Or expression, or can I pack all these pups into a Variable and apply my If End If expression to just the variable? -- Dave Temping with Staffmark in Rock Hill, SC |