samhow
Guest
|
Hi,
I am looking for some help getting the Excel ExcelRange.find function to work.
I want to search a column for a value and get the row number of the first cell that contains
the value.
Currently my code looks like this :
fndRng := wrkSheet.cells.Find(val,wrkSheet.Cells.item[1,col], xlValues,
emptyParam, emptyParam, emptyParam, true, false);
Currently it returns the error message : Could not convert type variant to type boolean.
I am doing this in the hope that the Excel find function will be faster than looping through the rows myself in delphi and looking for the value.
All suggestions appreciated.
Thanks
Sam |
|
samhow
Guest
|
I managed to get a search of a single column working with this code :
tstRng := wrkSheet.Range[wrkSheet.Cells._Default[1, col],
wrkSheet.Cells._Default[
X wrkSheet.UsedRange[adxLCID].Rows.Count, col]]
.Find(
val, wrkSheet.Cells.Item[1,col], xlValues, xlWhole, xlByRows, xlPrevious,
X false, false);
if assigned(tstRng) = false then begin
// not found
end else begin
// found on the row : tstRng.row;
end; |
|
Eugene Astafiev
Guest
|
Hi Sam,
Thank you for sharing the solution for others. Good luck with your add-in project! |
|