This may not help; I was getting an error on this line:
If target <> "" And target.Column = 10 Then Call copie(target): Exit Sub
However I was exploring column D which had the function =LastAuthor() and this was showing as #NAME?
So when the code reached If target <> "" while target was an error it caused the whole line to error.
2 things:
1. change that line to:
If target.Column = 10 Then If target <> "" Then Call copie(target): Exit Sub
This separates the two tests, so there's less likely to be an error generated in column 10 (no formula).
2. Why is there an error in cells with =LastAuthor() ?
It's because you've named a module LastAuthor as well as a function LastAuthor. Change the module name to say LastAuthor_ then there won't be a clash. (You don't need to have individual UDFs in separate modules, you can put them all together in one.
As an aside, the line in Sub copie(valeur):
zone.Copy l.Range
copies formulae too, so there's a danger that a formula such as =ListAuthor() will recalculate when another user comes along. Consider doing something along the lines of:
l.Range.value = zone.Value
This should copy plain values over which won't change when other users open the workbook.
|