Thanks all. It's clear to me now that I can't change a cell with a UDF if this cell is the caller.

As you understood I'm working with fractions. My aim is to display a fraction as it is inserted in a cell (for example 4/10) and not as it is diplayed by excel in its simple fraction 2/5. If I had had only decimal fraction (1/10, 2/10, 4/10,...) I could have used the numberformat "# ?/10" but the problem is that the base number is always different.

To this point, mdmackillop's solution is good.