I am wrestling with this and several times thought I had it. What I need is code that restricts entry in a textbox on a userform to characters from 0 to 9, does not allow a leading 0 and does not allow values greater than 31. Does anyone have any ideas? It doesn't sound hard, but my poor brain is dripping with sweat after a day spent with this.