I have the following code from Ozgrid which works fine but I would prefer it to be in a module rather than the Userform.
If I move it into the modules an error throws up at 'Me.'. I presume i have got to point it towards the current userform (ShortfallBalanceStatement btw)?
Code:
Private Sub OnlyNumbers()
With Me.ActiveControl
If Not IsNumeric(.Value) And .Value <> vbNullString Then
MsgBox "Sorry, only numbers allowed"
.Value = vbNullString
End If
End With
End Sub
If I move it into the modules an error throws up at 'Me.'. I presume i have got to point it towards the current userform (ShortfallBalanceStatement btw)?