+ Reply to Thread
Results 1 to 9 of 9

Can I get VBA script to read a word with both lcase and ucase lett

  1. #1
    Calle
    Guest

    Can I get VBA script to read a word with both lcase and ucase lett

    Hi!
    I am using this script but it can only read text with small letters. Can I
    change it to read with both small and big letters:

    Case Is = "i13"
    If LCase(.Value) = LCase("select door") Then
    'skipit
    End If

  2. #2
    Norman Jones
    Guest

    Re: Can I get VBA script to read a word with both lcase and ucase lett

    Hi Calle,

    Using LCase on both sides of the comparison expression reders the test case
    insensitive and, consequently, your code should accept the sought text in
    any casr, or mix of cases.


    ---
    Regards,
    Norman



    "Calle" <[email protected]> wrote in message
    news:[email protected]...
    > Hi!
    > I am using this script but it can only read text with small letters. Can I
    > change it to read with both small and big letters:
    >
    > Case Is = "i13"
    > If LCase(.Value) = LCase("select door") Then
    > 'skipit
    > End If




  3. #3
    Calle
    Guest

    Re: Can I get VBA script to read a word with both lcase and ucase

    ok, thx I try that. one more question. Is ther a way to get a script to
    delete content in merged cells. I can only get the script to delete in
    normal cells.

    script:

    Case Is = "i17"
    If LCase(.Value) = LCase("clear") Then
    Selection.Offset(1, -2).ClearContents
    Else

  4. #4
    Norman Jones
    Guest

    Re: Can I get VBA script to read a word with both lcase and ucase

    Hi Calle,

    Try:

    Case Is = "i17"
    If LCase(.Value) = LCase("clear") Then
    With Selection.Offset(1, -2)
    If .MergeCells Then
    .MergeArea.ClearContents
    Else
    .ClearContents
    End If
    End With
    Else



    ---
    Regards,
    Norman


    "Calle" <[email protected]> wrote in message
    news:[email protected]...
    > ok, thx I try that. one more question. Is ther a way to get a script to
    > delete content in merged cells. I can only get the script to delete in
    > normal cells.
    >
    > script:
    >
    > Case Is = "i17"
    > If LCase(.Value) = LCase("clear") Then
    > Selection.Offset(1, -2).ClearContents
    > Else




  5. #5
    Dave Peterson
    Guest

    Re: Can I get VBA script to read a word with both lcase and ucase

    One way:
    Selection.Offset(1, -2).value = ""

    Calle wrote:
    >
    > ok, thx I try that. one more question. Is ther a way to get a script to
    > delete content in merged cells. I can only get the script to delete in
    > normal cells.
    >
    > script:
    >
    > Case Is = "i17"
    > If LCase(.Value) = LCase("clear") Then
    > Selection.Offset(1, -2).ClearContents
    > Else


    --

    Dave Peterson

  6. #6
    Calle
    Guest

    Re: Can I get VBA script to read a word with both lcase and ucase

    thx for the reply !

  7. #7
    Norman Jones
    Guest

    Re: Can I get VBA script to read a word with both lcase and ucase

    Hi Dave,

    A much simpler answer!

    I never use merged cells - and it shows!

    ---
    Regards,
    Norman



    "Dave Peterson" <[email protected]> wrote in message
    news:[email protected]...
    > One way:
    > Selection.Offset(1, -2).value = ""





  8. #8
    Dave Peterson
    Guest

    Re: Can I get VBA script to read a word with both lcase and ucase

    I would think that this would work, too:
    Selection.Offset(1, -2).MergeArea.ClearContents
    even if the range isn't merged.

    (untested, though)

    Norman Jones wrote:
    >
    > Hi Dave,
    >
    > A much simpler answer!
    >
    > I never use merged cells - and it shows!
    >
    > ---
    > Regards,
    > Norman
    >
    > "Dave Peterson" <[email protected]> wrote in message
    > news:[email protected]...
    > > One way:
    > > Selection.Offset(1, -2).value = ""


    --

    Dave Peterson

  9. #9
    Chip Pearson
    Guest

    Re: Can I get VBA script to read a word with both lcase and ucase lett

    If you put

    Option Compare Text

    at the very top of your module, text comparisons are
    automatically done case-insensitive, so there is no need for the
    conversion to LCase.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "Calle" <[email protected]> wrote in message
    news:[email protected]...
    > Hi!
    > I am using this script but it can only read text with small
    > letters. Can I
    > change it to read with both small and big letters:
    >
    > Case Is = "i13"
    > If LCase(.Value) = LCase("select door") Then
    > 'skipit
    > End If




+ 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