Search code examples
c#excelexcel-dnavba

VBA Match to C#


I'm converting Excel VBA to C# (using a VSTO project in Visual Studio .NET). The bellow code is puzzling me, since there are no similar function in C#.

result = Application.WorksheetFunction.Match(stringA, Range(stringB), 0)
If result = 0 Then DoStuff

How can I replicate the above functionality in C#? Thanks


Solution

  • Try this

    result = Application.WorksheetFunction.Match(stringA, Range(stringB), 0);
    if (iTemp_result == 0) 
    {
        DoStuff();      
    }