+ Reply to Thread
Results 1 to 6 of 6

write name checking function where case sensitivity does not matter

  1. #1
    Registered User
    Join Date
    05-01-2008
    Posts
    9

    write name checking function where case sensitivity does not matter

    I'm having trouble writing a name checking VBA code where case sensitivity is removed.

    Given:
    uName is a string
    Worksheet 1, A1 = Cow

    uName = cow

    if uName <> Sheet1.A1.Value
    do something

    For some reason, case sensitivity matters. If i changed it to lower case C, it would work. I'm assuming excel changes the letters into values. Maybe I should set uName as an integer? I have no idea. Can someone help?

    Thanks

  2. #2
    Forum Contributor
    Join Date
    04-11-2005
    Location
    London
    Posts
    259
    What about using encasing your two variables with UCase to convert everything to uppercase? (In an Excel Worksheet, the corresponding command is UPPER)

    eg
    Please Login or Register  to view this content.
    Martin Short

  3. #3
    Forum Contributor
    Join Date
    04-11-2005
    Location
    London
    Posts
    259
    Also I'm not sure if you were just writing in pseudo-code, but presumably you mean
    Please Login or Register  to view this content.

  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
    As an alternative, you can put
    Please Login or Register  to view this content.
    ... at the top of the module.

    I recommend Martin's approach, though.

  5. #5
    Registered User
    Join Date
    05-01-2008
    Posts
    9
    I'll give it a shot. Yeah, i was just writing in pseudo code. It's easier to read... and write.

  6. #6
    Registered User
    Join Date
    05-01-2008
    Posts
    9
    thanks, worked. i just ucased everything.

+ 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