Vb.net Excel AverageIfs

时间:2018-01-10 10:20:56

标签: excel vb.net

运行以下代码以使用Vb.net执行AverageIfs时出现错误“WorksheetFunction类的AverageIfs方法失败”

        APPR = New Excel.Application
    Reportworkbook = APPR.Workbooks.Open(fd_file.FileName)
    Reportworkbook.CheckCompatibility = False
    APPR.DisplayAlerts = False
    APPR.Visible = True

    Dataworksheet = Reportworkbook.Worksheets("Data") ' the sheet name is Data


    Dim col As Excel.Range = Dataworksheet.Columns(6)
    Dim cellname As Excel.Range = Dataworksheet.Columns(4)
    Dim ss As String
    ss = APPR.WorksheetFunction.AverageIfs(col, cellname, Dataworksheet.Cells(18, 4))

0 个答案:

没有答案