Search in EXCEL-Sheets

Hello, I have an excel-sheet with about 25.000 rows. Now I want to find / search a special value in a row and activate this cell. The criteria for the search comes from Navision. The main problems are: 1) how to find the special value 2) how to activate the cell I can only use the automation-interface from navision (no excel-makro), because I have to write back some values from excel-sheet to navision. Has anybody any solution? thanx Martin

Hi Something like this should do the job: You have to take care for the case no entry is found. Then an error message in Excel will appear. ... MySearchString:= 'What ever'; xlRange:= xlSheet.Range('A:G'); xlRange.Select; xlRange.Find(MySearchString) ... As always: without testing it [;)]. bye André

Hello, thanks for the answer. I’ve tried it, but the cell isn’t active yet. What can I do??? martin

Hmm [:(]. OK. Trial and error [:D]: MySearchString:= 'What ever'; xlRange:= xlSheet.Range('A:G'); xlRange.Select; xlRange.Find(MySearchString); xlRange.Select; **or** xlRange.Activate; . **or** . xlRange:= xlSheet.Range('A:G').Find(MySearchString); bye André

Try this xlrange.cells.Find(parameters).Activate you can see all the parameters in excel by recording a macro.

I’ve tried: xlRange.Select; AND xlRange.Activate; when i next write: string:= FORMAT(xlrange.value); i got an error, that the datatyp isn’t supported. I think the range ist set for the column B yet and not for a single cell!? any ideas? martin

[:D] Good News: After I adapted my code a little bit, it works (but I don’t know why [?]) the solution is: Text:= ‘F51-1321-200’; xlrange:= xlworksheet.Range(‘B:B’).Find(Text); xlrange.Activate; Text1:= FORMAT(xlrange.Value); MESSAGE(Text1); but: Text:= ‘F51-1321-200’; xlrange:= xlworksheet.Range(‘B:B’); xlrange.Find(Text); xlrange.Activate; Text1:= FORMAT(xlrange.Value); MESSAGE(Text1); doesn’t work??? nice weekend[:)] martin