Morning good gentlemen!
I am trying to find a particular text (stored into a variable) in an excel spreadsheet. Then I need the cell location (B4, F6, etc) to then get the text right beside it. An example:
I type "Goose" into a textbox and then it searches for "Goose" in the excel file and returns the cell location or range. This word only appears ONCE and is loaded only once in the whole project. With this range I only trim out the letter out and use the number a a reference to the row where the "Goose" text is in.
I have this but I cant figure out the rest... btw regid is the text in string
Code:xlsWorkBook = xlsApp.Workbooks.Open("C:\filename.xlsx") xlsWorkSheet = xlsWorkBook.Sheets("Sheet1") Dim r As Excel.Range r = xlsWorkSheet.Cells.Find(regid, , _ Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, _ Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, False) msgbox("The row is"+left(str(r),1))




Reply With Quote
