+ Reply to Thread
Results 1 to 3 of 3

Upper & Lower case problem in VBA

Hybrid View

  1. #1
    Rob
    Guest

    Upper & Lower case problem in VBA

    I have the following formula to lock cells if the value in col I = X but
    sometimes it may be a lowercase x. How can this be adapted to lock the
    cells no matter if the x is upper or lower case?

    For Each cell In ActiveSheet.Range("I13:I1000")
    With cell
    .Offset(0, -7).Resize(1, 8).Locked = .Value = "X"
    End With
    Next cell




  2. #2
    JE McGimpsey
    Guest

    Re: Upper & Lower case problem in VBA

    one way:

    For Each cell In ActiveSheet.Range("I13:I1000")
    With cell
    .Offset(0, -7).Resize(1, 8).Locked = UCase(.Text) = "X"
    End With
    Next cell

    In article <eWR1sywDFHA.1836@tk2msftngp13.phx.gbl>, "Rob" <NA> wrote:

    > I have the following formula to lock cells if the value in col I = X but
    > sometimes it may be a lowercase x. How can this be adapted to lock the
    > cells no matter if the x is upper or lower case?
    >
    > For Each cell In ActiveSheet.Range("I13:I1000")
    > With cell
    > .Offset(0, -7).Resize(1, 8).Locked = .Value = "X"
    > End With
    > Next cell


  3. #3
    Rob
    Guest

    Re: Upper & Lower case problem in VBA

    Thanks JE,
    Works great and such a minor change too as I was expecting some complex
    code.

    Rob

    "JE McGimpsey" <jemcgimpsey@mvps.org> wrote in message
    news:jemcgimpsey-B43100.18122609022005@msnews.microsoft.com...
    > one way:
    >
    > For Each cell In ActiveSheet.Range("I13:I1000")
    > With cell
    > .Offset(0, -7).Resize(1, 8).Locked = UCase(.Text) = "X"
    > End With
    > Next cell
    >
    > In article <eWR1sywDFHA.1836@tk2msftngp13.phx.gbl>, "Rob" <NA> wrote:
    >
    >> I have the following formula to lock cells if the value in col I = X but
    >> sometimes it may be a lowercase x. How can this be adapted to lock the
    >> cells no matter if the x is upper or lower case?
    >>
    >> For Each cell In ActiveSheet.Range("I13:I1000")
    >> With cell
    >> .Offset(0, -7).Resize(1, 8).Locked = .Value = "X"
    >> End With
    >> Next cell




+ 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