beartooth91
Board Regular
- Joined
- Dec 15, 2024
- Messages
- 64
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hello
Here's an easy one (just not easy for me!): I have a list of data where I have tag information where some have wildcard characters present in the tag name. All I'm wanting to do is highlight the cells with alphanumeric strings containing # or ?
1NSSLI001-SEL (proper name, do not highlight)
1NSSLI####X (highlight)
1NSS??#### (highlight)
1NSSLI001-? (highlight)
1-NSS-??-#### (highlight)
I know that VBA is flakey when searching for strings containing wildcard values and my code, below, is highlighting even the proper names......
Here's an easy one (just not easy for me!): I have a list of data where I have tag information where some have wildcard characters present in the tag name. All I'm wanting to do is highlight the cells with alphanumeric strings containing # or ?
1NSSLI001-SEL (proper name, do not highlight)
1NSSLI####X (highlight)
1NSS??#### (highlight)
1NSSLI001-? (highlight)
1-NSS-??-#### (highlight)
I know that VBA is flakey when searching for strings containing wildcard values and my code, below, is highlighting even the proper names......
VBA Code:
For Each cell In .Range("R11:R" & lr)
If cell.Value Like "*####*" Then
cell.Interior.ColorIndex = 22
cell.Offset(, -16).Interior.ColorIndex = 6
ElseIf cell.Value Like "*?*" Then
cell.Interior.ColorIndex = 22
cell.Offset(, -16).Interior.ColorIndex = 6
ElseIf cell.Value Like "NOT FOUND" Then
cell.Interior.ColorIndex = 22
cell.Offset(, -16).Interior.ColorIndex = 6
End If
Next cell