Hi all,
I'm trying to loop down columb A in an Excel file looking for numbers that the program will ultimatly match with what it finds down columb A in another file.
Right now I can't get it to loop down and find "789" which I haven as line 3. Any help appreciated:
I'm trying to loop down columb A in an Excel file looking for numbers that the program will ultimatly match with what it finds down columb A in another file.
Right now I can't get it to loop down and find "789" which I haven as line 3. Any help appreciated:
VB.NET:
Dim xlsApp As Excel.Application
Dim xlsWB As Excel.Workbook
Dim xlsSheet As Excel.Worksheet
Dim xlsCell As Excel.Range
Dim i As Integer = 1
xlsApp = New Excel.Application
xlsApp.Visible = False
xlsWB = xlsApp.Workbooks.Open(lblFile1Location.Text)
xlsSheet = xlsWB.Worksheets(1)
xlsCell = xlsSheet.Range("A" & i)
Do Until xlsCell Is Nothing
If xlsCell Is "789" Then
MessageBox.Show("789 found")
Exit Do
Else
i = i + 1
End If
Loop