+ Reply to Thread
Results 1 to 13 of 13

force all caps

  1. #1
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Thumbs up force all caps

    Since excel does not allow you to select "all caps" on the font select screen, is there a way to force the spreadsheet to make all letters / words capitalized even if a user type in lower case?
    Last edited by vamedic11; 12-29-2011 at 01:07 PM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: force all caps

    Try using Data Validation, custom option and this formula:

    =EXACT(UPPER(A1),A1)

    I suggest you create a custom Input message (via the DV dialog) or a custom Error Alert.
    Be sure the Alert style is set to stop.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: force all caps

    Only economically by using VBa in the Sheet Module Change Event, or the Woorkbook SheetChange Event.

    e.g. In the Sheet Module
    Please Login or Register  to view this content.
    You could use WorksheetFunction.Upper(Target) to force all capitals or WorksheetFunction.Lower(Target) for all lower case.
    This of course will fail if the workbook is opened without enabling macros.

    [EDIT]
    I have used Ucase(Target) and Lcase(Target) in this demo. Type anything in any cell.

    This will also cause problems with formula that return text values, so in practice it is better to control only the ranges you need to.
    Attached Files Attached Files
    Last edited by Marcol; 12-27-2011 at 12:18 PM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: force all caps

    Events, Marcol, Events ...
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: force all caps

    You could select the entire sheet pick a font that looks like all caps. (try CarbonBlock)
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: force all caps

    Indeed shg ... and consequenses ...

  7. #7
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Re: force all caps

    Hey all. thanks for the responses. I tried Marcol's code but am now getting a runtime error in another part of the same macro. I am trying to troubleshoot now

  8. #8
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Re: force all caps

    Going crazy here

    When I put the code Marcol provided
    Please Login or Register  to view this content.
    in ThisWorkbook, it has no effect. When I add it to sheet1 I get the following error message. "Compile error: ambiguous name detected: Worksheet_Change"

    I did have existing code in both, so it may be a syntax error on my part but have been unable to figure it out. Below is the full code in Sheet1, including Marcol's addition.
    Please Login or Register  to view this content.
    I am also attaching the whole workbook for reference if needed.

  9. #9
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: force all caps

    Good morning vamedic11

    Each worksheet can only have one module for each type of event. The "ambiguous name" error is symptomatic of this. That said, the one worksheet change module you are allowed can do as many things as you want it to - they will all happen when the worksheet is changed.

    Just merge the two pieces of code and all should be well.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  10. #10
    Registered User
    Join Date
    12-28-2011
    Location
    India
    MS-Off Ver
    2003, 2007 and 2010
    Posts
    34

    Re: force all caps

    Hi,

    Press Alt+F11 this will take you to VBE screen, in the left hand side you can see the word "This Workbook" double click on it. Now at the right hand side you can see two drop down. In the first drop down, choose "Workbook", in the second dropdown choose "SheetChange". Thsi will display something like the one listed below,

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

    End Sub



    Now in between these two line paste the single line code which is already given in this thread, which is

    If Not IsNumeric(Target) Then Target = UCase(Target)

    That's it you are good to go.

    Regards,
    Hariharan R

  11. #11
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Smile Re: force all caps

    With many, many thanks, I think I finally got it.

    This is the code as it now reads:
    Please Login or Register  to view this content.
    Everything appears to be working now

    Before I close this thread out, I did want to be sure this was the correct way to merge the two pieces of code. Does it look proper?

  12. #12
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: force all caps

    In addition to that said by others
    Your code is longer than needs be, see this example for the Sheet2 code, note how to use Select Case
    Please Login or Register  to view this content.
    Because you have Data Validation in Row 5 I think this would also work
    Please Login or Register  to view this content.
    Also remember that the sheet module refers to that sheet only therefore no need to exclude other sheets
    e.g. This is redundant
    Please Login or Register  to view this content.
    Excepting when used in the workbook module when it becomes
    Please Login or Register  to view this content.
    In all probability it could all be done in the Workbook Module
    Last edited by Marcol; 12-29-2011 at 07:25 AM.

  13. #13
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Re: force all caps

    Marcol and all, MANY thanks for all the help. Everything is working smooth again! I have added reputation points to each of the responses.

    Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1