Dim dlg As New OpenFileDialog '定义一个新的SaveFileDialog dlg.Filter= "Excel文件|*.xlsx" '设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮 Dim book As new XLS.Book(dlg.FileName) Dim sheet As XLS.Sheet = book.Sheets(0) For i As Integer = 0 To sheet.rows.count-1 If sheet(i,0).text = "合计" Then msgbox(i+1) End If Next End If