08-15-2019
02:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-15-2019
02:39 AM
Hi, many times this type of access to the Excel file has given me headaches. I take more time trying to find the error than accessing otherwise.
Below I show you a way to access an excel file.
If you find the value you are looking for in a row you can identify a value from the same row.
In order for this to work correctly and load all the values correctly, I would recommend that you load all the values in the "Series" column that are blank, because otherwise you will not take these comparison values because their value is "nothing".
Dim oValue As String = "100" Dim Dirxlsx As String = "C:\Users\Sergio\Downloads\Belt Data.xlsx" ''' Specify the template path Dim osheet As String = "Belt_Data" ''' Specify the sheet of the template xlApp = CreateObject("Excel.Application") xlApp.Visible = False xlWorkbook = xlApp.Workbooks.Open(Dirxlsx,False) xlWorksheet = xlWorkbook.Worksheets.Item(osheet) For row As Integer=2 To 147 oSeries = GoExcel.CellValue(Dirxlsx, osheet, "B" & row) If oSeries = oValue Then oStyle = GoExcel.CellValue(Dirxlsx, osheet, "C" & row) MessageBox.Show(oStyle) End If Next xlWorkbook.Close (True) xlApp.Quit
I hope this helps with your problem. regards
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn