Well as most of us know BMW will have us believe the batteries cannot be replaced and instead have to part with £100 ish for a new key fob.....read on, there is a way of changing the rechargable battery
First Pic: Original Key
Second Pic: Take a stanley or xacto knife and basically carefully cut the key open along the seam where the top and bottom joined...Start at the top where the keyring goes through and be careful not to go too deep and damage the insides.
Third Pic: Next take small chisel and brake the spot welds on the battery that connect it to the rest of the circuit board.
Fourth Pic: The battery you will need is a Panasonic VL20203v.It is then a simple matter of soldering the new one in and making sure everything fits back together. (remember to put the positive and negative the right way round)
Fith Pic: Unit superglued back together
Put the working key in the ignition. Turn to position 2 for like 1 second then back and remove the key.
Press and hold the "unlock" button then press the "lock" button 3 times, you should hear all the locks cycle through.
Now take the non working key and press and hold the "unlock" button then press the "lock" button 3 times.
Then turn the ignition on and off again to end the programming.
##A few things to remember##
Worth a shot only if its your spare key that is not working, you have nothing to lose (apart from a £6 battery). Would not advise you do it if you only have one key (as you may not be able to use the key at all if you make a mistake).
Be careful when opening the sealed key not to slice your fingers too much
Before glueing back together, tightly band the key back together first and test it
I cannot take credit for this instead it goes to Jason 77 in California Big thanks I believe form all of us, its going to save some of us a lot of money.
This is not guaranteed to work as your fob may be faulty and a replacement battery will not solve this.
If it is your battery that is the problem and you do it correctly it will work.
I have a battery on order and will post back in a week or so once I've given it a shot