Two different things, two different places.
Cheat codes go into the balloon on the map — click it and type there.
Your share code is what other players use to add you. To enter someone else's, open your friend list, choose "Add Friends", and type their code in. Your own share code is displayed on your profile, which is the one you hand out.
It's an easy pair to mix up, and a share code entered in the balloon will simply do nothing.