Any gas or diesel of the same approxiamate vintage has the same five speed I believe. It is a little longer so there is also a driveshaft issue to solve.
You would no longer know the two forty d you just brought home with one installed. They are not too common unfortunatly. If you seriously start a search you should find one eventually.
I have missed a couple myself in the last three years. I will not miss the next one.The most important issue when looking is people claiming they have a five speed. In reality they have the four speed plus reverse and are calling it a five speed. Verify somehow with them exactly what it is or you will waste time.
If You come up with two drop me a line.
It should have the shift linkage with it as a bare box might have you hunting for a long time to find the rest. Since you have the automatic your best bet is the whole scap car.
You need the pedal assembly, 240d flywheel, clutch, slave cylinder and plumbing etc. Driveshaft if in a 123 240d would be nice. Just make sure it is marked if you separate the halfs.