Changing text case in Excel
Author
Discussion

boyse7en

Original Poster:

7,707 posts

182 months

Monday 18th September 2023
quotequote all
I've got a large table of data. One of the columns is filled with brand names, which are all in uppercase.

I'd like to change these in my Excel spreadsheet to Upper and Lower case (or capitalize initial letter).

This very simple if I use the PROPER command within a Macro (not my Macro, nicked for an MS help page):

[i]Sub Proper_Case()
For Each x In Range("A5:A5000")
x.Value = Application.Proper(x.Value)
Next
End Sub[/i]

but I want it to ignore text strings of less than 3 letters, and leave them as UPPERCASE (eg. BMW, ICI, KTM, DPD, AJS etc)

Is there a way to do this within the macro?

nyt

1,897 posts

167 months

Monday 18th September 2023
quotequote all
something like

if len(x.Value) > 3
x.Value = Application.Proper(x.Value)
endif