MacMost Q&A Forum • View All Forum QuestionsAsk a Question

How To Write a Script To Capitalize a Selection Of Cells In Numbers?

Script to format text of selection of numbers cells, with first letter of each word capitalized.

TOM JONES becomes Tom Jones
GEORGE FORMAN becomes George Forman

and so on…

Retyping each cell to capitalize from ALL CAPS is way too time consuming.

Also selecting text of each cell requires many clicks on one cell. Then more clicks to choose the submenu to capitalize only one cell at a time.

When you have a large spreadsheet with ALL WORDS CAPITALIZED and you want to make it easer to read, All Words Capitalized it really requires a script.
—–
David Sullivan

Comments: 7 Responses to “How To Write a Script To Capitalize a Selection Of Cells In Numbers?”

    9 months ago

    Unless you are really good at scripting, don't do this as a script. You are already in Numbers, so use formulas to do it.

    Use the PROPER function to change TOM JONES to Tom Jones. So if these names are in column A, then have cell B2 be =PROPER(A2) and copy and paste to all of column B. Then you can copy and Edit, Paste Formula Results from B to A if you like, removing B when done.

    David Sullivan
    9 months ago

    Thank you, that's good advice, in line with Ockham's razor with the idea that, in trying to understand something, getting unnecessary information out of the way is the fastest way to the truth or to the best explanation.

    Thanks Gary...

    Bernard
    9 months ago

    @Gary, why do you recommend not to use scripts for such use cases? I think QuickActions called by shortcuts can really save a lot of time. I’m only wondering how long-lasting the code would be?
    Even simple things like below don’t seem to work after 2 years anymore.

    https://macmost.com/creating-useful-helper-actions-for-mac-numbers.html

    9 months ago

    Bernard: In this case it is just much easier. It could take a minute or two to do this by adding a column with a formula. Even someone like me couldn't create a script to do it that quickly. And, yes, scripting solutions may change more frequently, but in-sheet formula solutions should last.

    Bernard
    9 months ago

    Thanks Gary for your quick response! It's encouraging to hear that even for you it's not a matter of a few minutes to write such a script. ;-)
    Do you happen to have a working script solution at hand that allows to change the content of the selected cells? I'm looking for one that I could use as a basis for further customization.

    9 months ago

    Bernard: That one you linked to is a good one to start with. It should still work just fine.

    Bernard
    9 months ago

    Good that you have confirmed this. I got a weird type conversation error before but creating a fresh workflow helped. Now everything is working fine.
    Thank you very much Gary!

Leave a New Comment Related to "How To Write a Script To Capitalize a Selection Of Cells In Numbers?"

:
:
:
0/500 (500 character limit -- please state your comment succinctly and do not try to get around this limit by posting two comments)