Gabriel Rotar
New Member
- Joined
- Mar 5, 2021
- Messages
- 7
- Office Version
- 2013
- Platform
- Windows
Hello,
I created a macro to detect text errors, but I have a case where I need to identify the case where a comma is placed between 2 words without a space behind, so the macro should mark all the cells where the text contains situations like "r,p" or "a,N" but not with spaces or numbers included like "2,5" or "a, M".
Below is my search function, but the string format is my problem.
Thank you in advance! Have a good day!
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlTextString, String:="[a-z],[a-z]", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = vbGreen
End With
I created a macro to detect text errors, but I have a case where I need to identify the case where a comma is placed between 2 words without a space behind, so the macro should mark all the cells where the text contains situations like "r,p" or "a,N" but not with spaces or numbers included like "2,5" or "a, M".
Below is my search function, but the string format is my problem.
Thank you in advance! Have a good day!
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlTextString, String:="[a-z],[a-z]", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = vbGreen
End With