How often has it happened to me that I ran out of butter and used margarine instead. I really didn't like doing that in the pan, though, because it unfortunately always splatters so much. Here I have found a solution that solves the problem:
Salt and margarine in the pan
If you add a little salt to the margarine in the heated pan, the annoying splattering is eliminated.
Extra info:Margarine that is heated in the pan starts to splatter because of the heat.
Read also: The best tips for cooking with mineral water