I'm not sure how or why but I have some super skilled marksdwarfs. I dug down into Hell and built a staircase to the floor. One level up from the cavern floor is a small barracks with fortifications. The room is small, 2x8. I have 2 squads of 7 soldiers each set to train here. They are my lookout and shoot down anything that approaches the stairs up to the surface. Most of them are legendary marksdwarf skill and also trained with danger rooms for survivability if things get too close.
Ok, here is the interesting part. I was beginning to scout the top of hell looking for adamantine veins from beneath and my scouts discovered a group of Leech Monsters in the distance. I assumed it would be far out of range of my marksdwarfs. I gave both squads a kill order on them. Instead of closing the distance, they started to fire from their barracks. They have a clear line of sight, but it was really far away. I started counting tiles. about 55 on the Y axis and 66 on the X axis. I did some math and they are hitting and killing the demon 86 tiles away and UP one Z level, not down. I noticed not all of them are firing, I need to check if only the ones that are legendary crossbow skills are the ones shooting so far.
They definitely do not shoot automatically, but will when they have a manual kill order.
The wiki says the max range of a crossbow is 20. More Science is needed!