Alt-right click on the enemy unit. It switches to melee weapons.