Macro to change case to proper case in range of cells - Calc

Hello,

i seem to have developed a very bad habit of inadvertently hitting the Caps Lock when entering data in my spreadsheet and having to go back and correct it.
The answer might be a LO Basic macro that runs whenever I leave the cell that changes the content automatically to Proper case. No luck with web search for a Basic example but plenty of VBA codes.

I have nil experience in either - downloaded the Porting Excel/VBA to Calc/StarBasic pdf and working my way through it but I am totally lost and my attempts not getting anywhere. Would anyone please be kind enough to guide me on how to adapt the code from this web page ( Sample macro code to change the case of text in Excel - support.microsoft.com) to Basic:

Macro to Change All Text in a Cell Range to Initial Capital Letters

Sub Proper_Case()
’ Loop to cycle through each cell in the specified range.
For Each x In Range(“A1:A1000”)
’ There is not a Proper function in Visual Basic for Applications.
’ So, you must use the worksheet function in the following form:
x.Value = Application.Proper(x.Value)
Next
End Sub

It would be even better if the code ignored text already in capital letters in the cells.

Many thanks in advance for any help and assistance.

I have had similar issues with missing Shift and hitting Caps Lock. As I never use Caps Lock, I disabled the key via settings in my window manager; this may be an option for you if your operating system supports it.

Hallo
no need for stupid makro…
→→Format→→Text→…*

Hello karolus,

Thank you very much for your input, I was aware and already do make use of your suggestion and also Shift+F3 to cycle through the cases. Should have mentioned it, Sorry.

I was however after an automatic approach without having to go through the menus, mouse clicks or keyboard shortcuts to speed up my data entry and also looking for some guidance with VBA code conversion,

Incidentally your hightlight colour is a nice green combination for rows and column headers (not sure if that’s the right description) and menu selection text mine is a dull blue - would you mind please to let me know how to go about changing it, are you using a particular style or theme? I’m on Win 10 Pro.

Cheers

LO takes these settings from the corresponding settings of your operating system|windowmanager.
for me with »Debian Bullseye on a Raspberry-Pi« its →→Mainmenu→Settings→Apperiance Settings…

In what way do you think you can automate|accelerate that? we already finish the task with a single key-shortcut?

If possible the macro should run without any user intervention when exiting the cell rendering your “single key-shortcut” unnecessary therefore making it more productive and efficient. Once set I can for get about it. Hope that makes sense to you.