Excel automation

jakarjakar Member Posts: 2
edited 2002-10-09 in Navision Financials
Hi all, I have a problem reading from excel or rather looking up a value in a worksheet. The following code works well as long as the value I'm looking for exists in the worksheet else it crashes. Here's the code

xlRange := xlWorksheet.Range('c5:c900');
bFound := xlRange.Find(aNumber).Activate;
IF bFound THEN
tNumber := FORMAT(xlApplication.ActiveCell.Offset(0, -2).Value);
ELSE
tNumber := ''
;

As I said when bFound is true it works otherwhise it crashes. Is there a way to change this code so that it works when aNumber does not exist in the worksheet ??

I have tried every way I can think of so I'll would be very happy if anyone can give me some help.

Jan Karlsson
Sign In or Register to comment.