Function copy selected part (if selected)