decadence
Well-known Member
- Joined
- Oct 9, 2015
- Messages
- 525
- Office Version
- 365
- 2016
- 2013
- 2010
- 2007
- Platform
- Windows
Hi, Is it possible to match and Input box answer against RegEx so Special characters are used, can someone help please?
This is what I have so far
This is what I have so far
Code:
Dim MyStr As String, addStr As String, RegEx As Object
On Error Resume Next
addStr = InputBox("Cells...", "Enter Character")
Set RegEx = CreateObject("VBScript.RegExp")
On Error Resume Next
RegEx.Global = False
RegEx.Pattern = [~@#$^*()_+=[\]{}|\\,.?: -]
If Not addStr Like RegEx Then Exit Sub
If StrPtr(addStr) = 0 Then Exit Sub
If Len(addStr) > 2 Then MsgBox "Only 2 characters may be Used!": Exit Sub