ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I set caps lock as default? (https://www.excelbanter.com/excel-worksheet-functions/139014-how-do-i-set-caps-lock-default.html)

Mark Barnard

How do I set caps lock as default?
 
In an Excel worksheet, I have two cells in which I only want to enter four
letters of text each.

How can I set these cells to only display caps?

Thank you!

Mark Barnard


David McRitchie

How do I set caps lock as default?
 
Hi Mark,
I'm glad you want to be selective in what is capitalized.
You would want to use a Change Event Macro. Normally
this would encompass an entire column but for only two
cells the macro following was adapted from
http://www.mvps.org/dmcritchie/excel/event.htm#change_v

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo ErrHandler
If Target.Address = "$C$4" Or Target.Address = "$C$5" Then
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
End If
ErrHandler:
Application.EnableEvents = True
End Sub


To install right click on the sheet tab, then
"View Code", place the above macro after
the Option Explict statement

For more examples see
http://www.mvps.org/dmcritchie/excel/event.htm
http://www.mvps.org/dmcritchie/excel/proper.htm

---
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Mark Barnard" wrote in message ...
In an Excel worksheet, I have two cells in which I only want to enter four
letters of text each.

How can I set these cells to only display caps?

Thank you!

Mark Barnard





All times are GMT +1. The time now is 07:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com