My son is doing the same thing but he only hits me. I tried smacking him (on the nappy or lightly on his hand) back but I think it reinforced it. My steps are:

1) Tried the "No! Don't hit" but it had limited success. He only paid attention when Daddy said No.
2) If I am holding him, I immediately put him down and step away. He really doesn't like that and tries to get a cuddle. I then tell him not to hit mummy and he usually listens
3) If I am sitting down, I get up and step away. Same result as above

I will be interested to see if anybody has any other techniques more effective than mine as it is really frustrating.