sn152
Member
Hi All,
I have a regex function which will restrict the user from entering more than 4 digits in a cell. But the problem is, the user should be able to enter 4 digit number which can also start with 0. This is not possible using the below function. Please help me here. Thanks!
I have a regex function which will restrict the user from entering more than 4 digits in a cell. But the problem is, the user should be able to enter 4 digit number which can also start with 0. This is not possible using the below function. Please help me here. Thanks!
Code:
Function CheckSite(ByVal txt As String) As Boolean
With CreateObject("VBScript.RegExp")
.IgnoreCase = True
.Pattern = "^\d{4}"
CheckSite = .test(txt)
End With
End Function