Link to home
Start Free TrialLog in
Avatar of TIMFOX123
TIMFOX123Flag for United States of America

asked on

How do I check for any lower case letters in a col in excel ?

I have much data to check

I need to know if  col (A) is in all caps.
I need to know if co (B) is in all lower case.

If I make a mistake my boss says he will apply "capital punishment"

thx


Excel 07
Avatar of Brian Pierce
Brian Pierce
Flag of United Kingdom of Great Britain and Northern Ireland image

I came across this code on Mr Excel, which would do what you want with any selected range

Public Sub Format_Upcase()
 Application.ScreenUpdating = False 'speed up with large selections
 Application.Calculation = xlManual

 For Each xCell In Selection
 If UCase(xCell.Text) <> xCell.Text Then xCell.Value = UCase(xCell.Text)
 Next

 Application.Calculation = xlAutomatic
 Application.ScreenUpdating = True
 End Sub

 Just highlight the cells that must be in upper case and and run the macro
If you want to put things into lower case then use this macro instead

Public Sub Format_Locase()
 Application.ScreenUpdating = False 'speed up with large selections
 Application.Calculation = xlManual

 For Each xCell In Selection
 If LCase(xCell.Text) <> xCell.Text Then xCell.Value = LCase(xCell.Text)
 Next

 Application.Calculation = xlAutomatic
 Application.ScreenUpdating = True
 End Sub
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Formulawise you could use EXACT function, i.e. UPPER CASE in A2

=EXACT(A2,UPPER(A2))

and for B2 in lower case

=EXACT(B2,LOWER(B2))

regards, barry