I need a macro to identify special characters and single zero. Then highlight those rows and return with the row number in a pop up window.
Example of list in column A:
98%kl
45tds$
123450
0
CE 123
This is what I have so far, but I can't find the way to highlight rows with a single zero ("0") and can't make it return the row numbers
Any help will be appreciated
Example of list in column A:
98%kl
45tds$
123450
0
CE 123
This is what I have so far, but I can't find the way to highlight rows with a single zero ("0") and can't make it return the row numbers
Any help will be appreciated
Code:
Sub test()
Dim rng As Range, r As Range, m As Object
Set rng = Range("A1", Range("A" & Rows.Count).End(xlUp))
rng.Interior.ColorIndex = xlNone
With CreateObject("VBScript.RegExp")
.Global = True
.IgnoreCase = True
.Pattern = "([\(\)\\""!@#\$.%\^&\*\+\?~\€Ž\öôòóõ\~žŸœ¡¢£¤¥¦§®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûü\-]|CLN|DG |CE | )"
For Each r In rng
If .test(r.Value) Then
r.Interior.Color = vbYellow
For Each m In .Execute(r.Value)
With r.Characters(m.firstindex + 1, m.Length).Font
.Bold = True
.Color = vbRed
If rng Is Nothing Then
MsgBox "No violations found"
Else
MsgBox "Violation found at " & rng.Row
End If
End With
Next
End If
Next
End With
End Sub
Comment