KIRK: What's the point of capturing my ship? Even at maximum warp, the Enterprise couldn't get to Andromeda galaxy for thousands of years.
ROJAN: Captain, we will modify its engines, in order to produce velocities far beyond the reach of your science. The journey between galaxies will take less than three hundred of your years.
Just did the math for giggles. To make it to Andromeda in 300 years you'd have to travel at ~7,333 x light speed.