Good question.

Here are some thoughts.

Really in German and switzerland you see by the very end of the late medieval early modern trend of more handguns in armies, slowly displacing crossbows.

In 1509 I think Max makes a statement where in his new idea of army the crossbow has less of a place. By 1517 none.
This though is not including the levies if I understand it correctly but his army. Many german shooting clubs started mid 15th and continued on thereafter for military aspects for some time when needed so they cannot be totally discounted.

France used xbows on for another 3-5 decades as did spain, italy in certain degrees sometimes exclusivel sometimes in combination with.

By this time I think three aspects were becoming visible.

One that the crossbow was reaching a technological limit at that time for materials availible and very expensive, often three to five times as expensive which with some guns being expensive is a great investment. I do not think it disappeared as long as the levy was in use. Once more state run armies grew they are looking to maximize their money by arming as many men as possible.

That the way warfare was developing high accuracy was becoming secondary to mass fire. They just wanted as many men in one place firing in the same direction. Aim still is of course used but not precision. You also can get more gunners than bowman for your money.

Third. the gun was just getting started technology wise. Circa 1500 improvements in firing devises, barrel length, powder, and most importantly development time where people A, found how to make effective guns in fabrication and B, found how to use them in battle effectiveley gave the gun a advantage it showed potential to advance more quickly. They also could blast holes in all but the best plate which as the 16th gets on is a great benefit that others cannot boast.

RPM