First, it's spelled "
lens". Second, there are a few choice
lenses that will work on the D40, but you have to be careful to choose ones that have integrated focus motors else you will be stuck focusing manually:
http://www.sigmaphoto.com/lenses/lenses_all.asp
Look in the macro lenses section, you have ranges from 50mm to 180mm.
THIS is the one that I use and I am very satisfied with it's performance. Tack sharp, fast focus and for me, the perfect focal range to do not just macro shots, but portrait shots as well. I like the range because at the smaller focal points, you are forced to place the lens too close physically to your object and if it is something living, it would get scared away. The 105mm is about the minimum I would suggest. You can get a true 1:1 macro from just over 12 inches away. The 150mm would make that about 15 inches, the 180mm about 18 inches and for a point of reference, the with the 50mm, your lens has to be 7.4 inches away from the object to get a 1:1 macro shot.
In the Sigma world, any lens that has the HSM designation will autofocus on your D40.
You have pretty much more than enough to budget for any of these lenses. For example the 180mm (the most expensive), is available on Amazon.com for just under $700US and the other lenses are lower in price. Thanks to our Canadian dollar's weakness, that would be just under the $1,000.00Cdn range.
Good luck!