On Tue, 7 Sep 1999 14:41:53 +0200, "o.Schwierz" wrote: >I want to create a function that checks if a special makro is running during >the double-click-event (BeforedoubleClick). >During the BeforedoubleClick-event this function is called to check if a >sub-procedure is running. >When this sub-procedure starts, it calls the same funktion to set the mode >to "makro active" (MakroActive (True) ). >At the end of this sub the function is called to cange the mode to "makro >not active" (MakroActive (false) ). >The double-click should copy several cells to another sheet, but only if the >event happens during the makro. When the makro is not running, the >double-click should work as usual. I assume you want the macro to do 3 different things, depending on the whether the argument is missing, True, or false. You can't specify 3 conditions with a Boolean variable. To be able to test whether the argument is missing, the argument must be a variant. The following modification always returns the value of the static variable. function MakroActive(Optional ActivateIt As Variant) As Boolean Static MIsActive As Boolean On Error Resume Next If Not IsMissing(ActivateIt) Then MIsActive = CBool(ActivateIt) MakroActive = MIsActive end function I added the error trapping because CBool will only handle text arguments of True and false. If you call it with ActivateIt = "YES", it triggers a type-mismatch error. In that case, the function behaves as though the argument is missing.