Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calling VBA code from html or javascript | Excel Discussion (Misc queries) | |||
Calling a bit of code from a sheet errors | Excel Discussion (Misc queries) | |||
Match Function(Code modification) | Excel Programming | |||
Calling an XLA macro from code | Excel Programming | |||
Calling HTML Source code from within VBA for Excel | Excel Programming |