In the VBA Editor you can lock the VBA project with a password. Keep in mind, though, that this password is inherently insecure, and can be cracked very, very easily using readily available, inexpensive hacking tools.

Screen captures showing the steps to lock the VBA code for viewing and editing. Select the Protection tab in the VBAProperties Dialog check box, click the box to prevent viewing and enter a password required to open the project. As Patrick noted above, this can be hacked very easily with tools if someone really wants your code. If the requirement is to prevent your user community from accidentally changing the code, this works very well.

Do note, though, that sharing the workbook is itself inherently dangerous; having multiple people in the file at once creates a huge risk of file corruption. It is only a slight exaggeration to say that there are only two types of shared workbooks: those that are corrupt, and those that soon will be :)