Is it possible to continue using an to external monitor when closing the lid on a Macbook Air?

Solution 1:

Yes, its called "closed clamshell" mode. In short, you'll need to attach your MBA to a mouse, a keyboard and power:

https://support.apple.com/HT201834

Solution 2:

Yes, I think keeping the power on here is the key. When I remove the magsafe from my MBP it automatically goes to sleep and turns off the external display.

If you really want to keep it from sleeping even when you are not connected to an external power source, you can use InsomniaX or Caffeine.