I have multiple textboxes on multiple forms that use the following code to restrict character input. Is there a way to set something up in a standard module to avoid duplicating the code?

Private Sub txtYr2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")

Case Else
KeyAscii = 0
End Select
End Sub

Private Sub txtYr3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")

Case Else
KeyAscii = 0
End Select
End Sub

Cheers Peter