View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Kevin Vaughn Kevin Vaughn is offline
external usenet poster
 
Posts: 111
Default Unable to get Match property of worksheetfunction

set rng = Range("M1:M200")(res)

I wasn't familiar with the use of (res) as above. Interesting.

Thanks for the ideas.
--
Kevin Vaughn


"Tom Ogilvy" wrote:

You can still use it.

You could test first if the value is lower than the lowest value and act
according, but if it isn't then use match.

Dim res as Variant
for each cell in Range("A1:A10")
if cell.value < Range("M1") then
' lower than
else
res = Application.Match(cell.Value, Range("M1:M200"),1)
set rng = Range("M1:M200")(res)
rng.select
end if
Next


Or you could just use Match and trap for the value.

Dim res as Variant
for each cell in Range("A1:A10")
res = Application.Match(cell.Value, Range("M1:M200"),1)
if iserror(res) then
' match raised an error
else
set rng = Range("M1:M200")(res)
rng.select
end if
Next

--
Regards,
Tom Ogilvy