I've got the following code in cell d1
(Username() is a function in a module which gets the user's username)

=IF(ISBLANK(A1),"",UserName())

What I want is to set D1 to the user name only when A1 changes from blank to not-blank

At the moment if A1 is non-blank D1 get updated whenever the spreadsheet is opened

So I supose I need a sort of onchange event on A1
How?

Thanks