@fify-- You can try it, but it's a good idea to show him to a vet first.
I use ranitidine for hives, but I don't use it alone. I take it with an antihistamine medication. Ranitidine by itself doesn't treat my hives.
Ranitidine is safe for pets as long as you don't give them too much. So it might be worth a shot. But I do hope that you have showed him to a vet, because it might be serious.