+ Reply to Thread
Results 1 to 12 of 12

Make macro work with upper case and lower case

  1. #1
    Registered User
    Join Date
    02-23-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Make macro work with upper case and lower case

    Hello! I have the following Macro (below) in a spreadsheet I use to record work times for my employees. In column C there is a dropdown in which they are supposed to choose "ARRIVED," and then a timestamp appears in both column D and P. Similar for column E - they're supposed to select "DEPARTED" from a dropdown menu and then it enters a timestamp in both column F and Q.

    The trouble is, sometimes employees type "Arrived" or "Departed" instead of using the dropdowns. Because these are the correct words the dropdown error function doesn't alert, but unfortunately the Macro doesn't run. Is there a way to make the Macro not case-dependent?

    Thanks!

    Please Login or Register  to view this content.
    Last edited by Caitlin535; 11-06-2019 at 12:56 PM.

  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: Make macro work with upper case and lower case

    Welcome to the board.

    Please take a few minutes to read the Forum Rules, and then edit your post to wrap your code with CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Make macro work with upper case and lower case

    Can't you use UCASE(Target.Value) on the appropriate lines?

    By the way, you should put code tags around your code - refer to the Forum Rules at the top of the screen.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    02-23-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Make macro work with upper case and lower case

    Apologies - I did read the rules, but then forgot! Corrected now.

  5. #5
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Make macro work with upper case and lower case

    Could you not use validation and a dropdown to select "ARRIVED" and "DEPARTED"

  6. #6
    Registered User
    Join Date
    02-23-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Make macro work with upper case and lower case

    Hi Pete_UK -
    I suspect I can, but I'm an *infant* when it comes to VBA code (although this is how I'm learning it) - could you please just clarify where I would put UCASE(Target.value)?

    And yes, I apologize for initially not putting in code tags - I've corrected it. Apologies!

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Make macro work with upper case and lower case

    Try having a look on the other site you have asked this question.

    Also please read the rules & supply the relevant cross post link.
    Thanks

  8. #8
    Registered User
    Join Date
    02-23-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Make macro work with upper case and lower case

    Yes, that's exactly what I do - dropdowns with the options "ARRIVED" on one and "DEPARTED" in the other. I have it set to give a "Stop" error message when any other data is entered in the cell, but it seems that Excel doesn't recognize "Arrived" (or conversely, "Departed") as invalid. It seems like the List data validation isn't case-dependent.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Make macro work with upper case and lower case

    Use UCase (or LCase) on both the value you want to check and the value you want to check against.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  10. #10
    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: Make macro work with upper case and lower case

    Or just add Option Compare Text at the top of the module.

  11. #11
    Registered User
    Join Date
    02-23-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Make macro work with upper case and lower case

    Apologies to everyone - I initially hadn't realized I was posting on not my usual site (MrExcel.com), and then posted this question over there as well, where it has been answered.
    I've tried posting the link here, but it actually won't allow me to post links until I've posted a few times.
    Again, I'm so sorry for the inadvertent cross-posting, but thank you all so very much for your help!

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Make macro work with upper case and lower case

    As the OP can't post links, it's here https://www.mrexcel.com/forum/excel-...ower-case.html

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Change name format including adjusting upper case to lower case
    By johnmitch38 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-26-2019, 07:53 AM
  2. Replies: 1
    Last Post: 07-14-2016, 05:51 AM
  3. Replies: 7
    Last Post: 04-18-2014, 04:11 PM
  4. [SOLVED] Lower Case to Upper Case but No Auto Correction : Solved by Mod (6StringJazzer)
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-27-2014, 10:44 AM
  5. Make Upper Case in cells become lower case
    By davidx in forum Excel General
    Replies: 2
    Last Post: 12-02-2013, 08:40 AM
  6. Replies: 2
    Last Post: 12-09-2005, 05:15 AM
  7. Replies: 14
    Last Post: 08-25-2005, 10:05 PM

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