LionisIAm
LionisIAm

Reputation: 761

Excel.Range.Find always returns null

He everyone! I am new to office embedded developing. I have a part of code which has to find value in a range but its always returns as null: (i - is iterator index)

 xlWorkSheet.Cells[100, 100] = karts[i].minTime.ToString();
 Excel.Range a = xlWorkSheet.Range["D2", "N2"].Find(xlWorkSheet.Cells[100, 100]);
 if(a!=null)
            a.Borders.Color = 3;

So when I found a value in range i want to border it but if is always skipped by null.

Upvotes: 0

Views: 431

Answers (1)

Thunder_Lord79
Thunder_Lord79

Reputation: 83

You should write

while(a!=null)
{
a.Borders.Color = 3;
}

Because Find will only look for the first object all acording to Microsoft How to:

Upvotes: 2

Related Questions