![]() |
Calling Match function from code
I'm programming Excel from C# (using a VSTO project in Visual Studio .NET).
How do I use the Match function from within code? I've seen macro examples on the newsgroup that do Application.Match(). But the Application object, as I see it in C# doesn't have a Match function on it. How can I get to it? thanks, Backslider |
Calling Match function from code
I should have added that I know nothing of C#. All these examples work ok in
VBA, though. Dave Peterson wrote: Maybe you'll find it under: application.worksheetfunction.match or even worksheetfunction.match But try your code with application.match. It works in Excel's VBA and is easier to look for a match: dim res as variant with activesheet res = application.match(.range("a1").value, .range("b1:b99"), 0) end with if iserror(res) then 'no match else 'match found end if vs. dim res as long with activesheet on error resume next res = application.worksheetfunction.match(.range("a1").v alue, _ .range("b1:b99"), 0) end with if err.number < 0 then 'no match err.clear else 'match found end if on error goto 0 Backslider wrote: I'm programming Excel from C# (using a VSTO project in Visual Studio .NET). How do I use the Match function from within code? I've seen macro examples on the newsgroup that do Application.Match(). But the Application object, as I see it in C# doesn't have a Match function on it. How can I get to it? thanks, Backslider -- Dave Peterson -- Dave Peterson |
All times are GMT +1. The time now is 03:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com