+ Reply to Thread
Results 1 to 3 of 3

UDF - case sensitive argument

  1. #1
    ed
    Guest

    UDF - case sensitive argument

    Here is my issue:
    For example, ‘txt’ is coming from a cell in a worksheet entered by the user.

    Function Test(txt as string) as string
    If (txt = "comm. lse" Or txt = "ME") Then
    Do this
    Else
    Do that
    End If
    End Function

    If the user enters Comm Lse, the statement will “Do that� instead of “Do
    this�. Any suggestions? (drop downs are not welcomed by the users...yet!)


  2. #2
    JulieD
    Guest

    Re: UDF - case sensitive argument

    Hi Ed

    if you want a case insesitive function you can do something along the
    following lines

    Function Test(txt As String) As String
    If (LCase(txt) = "comm. lse" Or UCase(txt) = "ME") Then
    Do this
    Else
    Do that
    End If
    End Function

    Cheers
    JulieD

    "ed" <[email protected]> wrote in message
    news:[email protected]...
    > Here is my issue:
    > For example, 'txt' is coming from a cell in a worksheet entered by the
    > user.
    >
    > Function Test(txt as string) as string
    > If (txt = "comm. lse" Or txt = "ME") Then
    > Do this
    > Else
    > Do that
    > End If
    > End Function
    >
    > If the user enters Comm Lse, the statement will "Do that" instead of "Do
    > this". Any suggestions? (drop downs are not welcomed by the
    > users...yet!)
    >




  3. #3
    JE McGimpsey
    Guest

    Re: UDF - case sensitive argument

    If you're just worried about case:

    Public Function Test(txt As String) As String
    If (LCase(txt) = "comm. lse" Or UCase(txt) = "ME") Then
    'Do this
    Else
    'Do that
    End If
    End Function

    note that this will not catch the lack of a "." in your example.


    In article <[email protected]>,
    "ed" <[email protected]> wrote:

    > Here is my issue:
    > For example, ‘txt’ is coming from a cell in a worksheet entered by the user.
    >
    > Function Test(txt as string) as string
    > If (txt = "comm. lse" Or txt = "ME") Then
    > Do this
    > Else
    > Do that
    > End If
    > End Function
    >
    > If the user enters Comm Lse, the statement will “Do that� instead of “Do
    > this�. Any suggestions? (drop downs are not welcomed by the users...yet!)


+ 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