i have to do it with macro, because this condition is part of biggest macro in a userform text box.You don't need vba for that, just simple data validation using a formula as a custom validation rule.
Excel Formula:=AND(SEARCH("p",A1),--SUBSTITUTE(A1,"p","",1))
It would be a good idea to specify things like this in your question rather than adding them later. That way you might get what you actually need instead of the incorrect thing that you asked for.because this condition is part of biggest macro in a userform text box.