+ Reply to Thread
Results 1 to 6 of 6

VB Code To Force Upper Case?

  1. #1
    Registered User
    Join Date
    11-27-2008
    Location
    USA
    Posts
    43

    VB Code To Force Upper Case?

    When I use the following code to force uppercase in cell ranges using this code, I get a syntax error message when I test the cells on the worksheet. Not sure what the problem is, but instead of forcing by cell rangers, is there a code to use to force upper case by Columns B,C,D,E,F,G,AJ,AK,AL,AM,AN,AO? There are a couple of cells that contain formulas. I don't want it to change the formulas.

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 01-26-2009 at 05:54 PM. Reason: add code tags

  2. #2
    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: VB Code To Force Upper Case?

    Please edit your post to add code tags.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,440

    Re: VB Code To Force Upper Case?

    Hi,

    Try replacing this

    Please Login or Register  to view this content.
    with this

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Registered User
    Join Date
    11-27-2008
    Location
    USA
    Posts
    43

    Re: VB Code To Force Upper Case?

    Sorry! I don't understand :-(

  5. #5
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,440

    Re: VB Code To Force Upper Case?

    In your code you're trying to change a range to upper case with the line

    Target = UCase(Target)
    You need to change the contents of the range, hence

    Target.Value = UCase(Target.Value)

  6. #6
    Registered User
    Join Date
    11-27-2008
    Location
    USA
    Posts
    43

    Re: VB Code To Force Upper Case?

    Thanks very much!

+ 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