返回首页

干草家伙,
我有一个小问题,使用VB.NET,互操作,Excel的VBA
我试图寻找一个Excel文件,testing.xlsx Sheet2中柱H2-H10000
我想作为一个搜索参数使用重复计数变量。
唯一的问题是我不知道如何做到这一点的是vb.net的Excel互操作。
它将会非常感激,如果有人可以提供一些片断或东西,帮我解决这个问题。
这仅仅是一些代码,我放在一起,以帮助你帮我{S0的}


Imports Microsoft.Office.Interop

Imports System.Runtime.InteropServices

 

Class Form_Test

 

    Public MyWorkbook As New Excel.Application

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        MyWorkbook.Sheets("Sheet1").Select() ' This is the current Sheet

        Dim varsearch As String = TextBox10.Text ' The value will need to be searched and counted in an Excel Sheet

        Dim varresult As Integer = CInt(0)  ' This is the resulting number from the Counter



        ' Counter

' THIS is the line of which i have no idea of how to write it.

       varresult = MyWorkbook.Rows(MyWorkbook.ActiveCell.Column).'Count (varsearch) ToString() or something.



        MessageBox.Show("Your Repeating Value Is: " & varresult)

 

    End Sub

End Class

例如,我有一个Excel工作簿中的开放与我的应用程序,我想搜索字符串通过H10000"Item1的??在Sheet1中柱H2。我想它显示在MessageBox返回的数量,因为我很快就试图证明上面的代码。
我一直在试图得到这个工作有一段时间了,它变得有点累。

感谢您的阅读。:8327439 |会员

回答

评论会员:l 时间:2