:'<,'>y

:'<,'>y will yank from the beginning of the last visual selection, through the end of the last selection.
If you wish to paste the yanked lines, press p or P.

:y will copy the current line. :[range]y will yank (copy) the range of lines you declare. :1,$y will yank the entire file as $ represents last line in the file.
:5,10y will yank lines 5 through 10.

Further Reading

:h :y :h '> :h '<

More Gifs