Thank Oorang, but I still have the problem that the function doesn't want to work in other sheets than the one containing the array.