Hello ,
I'm just learning to program in visual basic .NET.
I need your help. I have this code:
Code:
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
Dim xlappFile As Microsoft.Office.Interop.Excel.Application = Nothing
Dim xlFile_WB As Microsoft.Office.Interop.Excel.Workbook = Nothing
Dim xlFile_WS As Microsoft.Office.Interop.Excel.Worksheet = Nothing
Dim xlFirstfile_WS1 As Microsoft.Office.Interop.Excel.Worksheet = Nothing
Dim FoundRange As Microsoft.Office.Interop.Excel.Range
Dim searchID As String
searchID = TextBox15.Text
xlFile_WB = xlappFile.Workbooks.Open("C:\Users\stich\Desktop\BAZA.xlsx")
xlFile_WS = xlappFile.Worksheets("pierwszy")
FoundRange = xlFile_WS.Cells.Find(What:=searchID, LookIn:=Microsoft.Office.Interop.Excel.XlFindLookIn.xlFormulas, LookAt:=Microsoft.Office.Interop.Excel.XlLookAt.xlWhole)
If FoundRange Is Nothing Then
MsgBox("nie znaleziono wyrazenia")
Else
FoundRange.Offset(0, 2).Value = ComboBox2.Text
End If
'zapis bazy danych
xlFile_WB.Save()
xlappFile.Quit()
End Sub
He wants to open the given excel file with a given button and search for the cell containing the text entered in texbox15. After Search for this cell in the appropriate columns, enter the values from the next textboxs.
Who will tell you how to do it?