All units in range of an enemy that have line of sight can shoot. Your own units don't block line of sight. So within range and line of sight, all 40 can shoot.
What @Ecozh said is correct, a part from a little detail: (from the last page of AoS rules...) So a Skink who is attacking with its Boltspitter (blowpipe) from the 2nd row can see an enemy in front of its own unit. On the contrary, Skinks in the same unit as before couldn't see the enemy if between the 2 there was a friendly unit os Saurus Warriors blocking line of sight, for example.
Wow... that is not how our group has played it.. Good to know when I face an Aelf force next time. Thanks Freddy!
You're welcome! I know lots of people don't follow this rule, and that means often a big advantage for shooting armies!
Ill put it up for discussion wednesday. The rule clearly says models within the unit. That means that If you can see your Desired target through gaps of another unit, then you can target it. But with some clever positioning this can be really interesting.