Lower case string substring check

Tanu

New Member
Joined
Feb 6, 2023
Messages
21
Office Version
  1. 365
Platform
  1. Windows
For eg - If there is any lower character then it should highlight to red color.....for eg- If we have a data like TAnU and it contains a lower case then it should highlight it in red color another eg - tANU then it also highlight so how we can implement it....
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
How about
Fluff.xlsm
A
1
2190 BXJ
3126 ZhK
4143 SPV
5328 PMC
6124 XNS
7392 YGX
8280 HFS
9386 HWK
10333 MZG
11345 ZVW
12370 NRC
13204 RRp
14408 KBF
Main
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A14Expression=LET(c,CODE(MID(A2,SEQUENCE(LEN(A2)),1)),SUM((c>=97)*(c<=122))>0)textNO
 
Upvote 0
How about
Fluff.xlsm
A
1
2190 BXJ
3126 ZhK
4143 SPV
5328 PMC
6124 XNS
7392 YGX
8280 HFS
9386 HWK
10333 MZG
11345 ZVW
12370 NRC
13204 RRp
14408 KBF
Main
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A14Expression=LET(c,CODE(MID(A2,SEQUENCE(LEN(A2)),1)),SUM((c>=97)*(c<=122))>0)textNO
Need proper VBA code for this
 
Upvote 0
Then why didn't you say that to start with?
Hopefully somebody will provide the code.
 
Upvote 0
VBA Code:
Sub jj()
        Dim Regex As Object
        Set Regex = CreateObject("vbscript.regexp")
        Dim rng As Range
        
        With Regex
            For Each rng In Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
                .Pattern = "[a-z]"
                If .Test(rng.Value) Then rng.Interior.Color = vbRed
            Next rng
        End With
        
End Sub
 

Attachments

  • 1676911797763.png
    1676911797763.png
    58.7 KB · Views: 7
Upvote 0
Solution
Bit late to the party but just stumbled on this thread and think this simple approach should do the job without the need for Regex.

VBA Code:
Sub HighlightLowerCase()
  Dim rng As Range
  
  For Each rng In Range("A1", Range("A" & Rows.Count).End(xlUp))
    If rng.Value <> UCase(rng.Value) Then rng.Interior.Color = vbRed
  Next rng
End Sub

1677145228805.png
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top