View Single Post
 
Old 02-13-2022, 12:07 PM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2019
Expert
 
Join Date: Apr 2014
Posts: 948
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

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.
Reply With Quote