I need to perform two different validation in two columns. In column "C" I need to check special characters and in column "D" I need to check if there are numbers.
Is there anyway I can achieve this using regEx in VBA?
Thanks for your help in advance
Dim strPattern As String: strPattern = "[^a-z]"
Dim regEx As Object
Set regEx = CreateObject("VBScript.RegExp")
regEx.Global = True
regEx.IgnoreCase = True
regEx.Pattern = strPattern
For Each cell In ActiveSheet.Range("C:C") ' Define your own range here
If strPattern <> "" Then ' If the cell is not empty
If regEx.Test(cell.Value) Then ' Check if there is a match
cell.Interior.ColorIndex = 6 ' If yes, change the background color
End If
End If
Next