If marksdwarves are literally standing on the enemy they WILL melee. However, the more prevalent behavior is shooting.
1) As one of the previous posters mentioned, make sure they are equipped with enough quivers. Sometimes, even if your fortress has just "enough" quivers, they may not be claimed and equipped by your markdwarf for a variety of possible reasons (hunters grab 'em first, being moved en route to a stockpile, at the bottom of a lake, dumped, forbidden, etc.). To check if your markdwarves have a quiver equipped, open up the unit list, select the soldier, press "i" (or something) and check their inventory list for a quiver.
2) While you're at it, make sure there are enough bolts available and assigned to your marksdwarves. Somewhere in the military interface (in the supplies tab I think?) there is the allocation of bolts to each squad and the hunters as a whole. By default hunters are assigned 250 bolts so unassign these if you have hunters. Then assign your squad a bunch of bolts (25 for each dwarf in the squad is suitable I think?) and make sure they are set to Combat - represented by a red C next to the amount of bolts. Whether or not they are also set to Train doesn't matter, I think. While you're in Step 1's inventory check for a quiver, if you do find the quiver, press Enter to check its contents and see if there are bolts in there.
3) If the above steps have not worked and you are ridiculously hopeful like me, make sure your markdwarf squad is assigned a barracks in which to sleep and train and also assigned a series of archery ranges set to train at. These were the requirements I've found markdwarves need to practice shooting instead of melee while in peacetime. Doing this step will probably not work, but yeah.
Sooooo, in summary, do everything you already said you did again.