+ Reply to Thread
Results 1 to 3 of 3

VBA and Case Insensitive

  1. #1

    VBA and Case Insensitive

    I have a piece of code that searches to find a string which triggers
    the start of an event (copy/paste). However, I cannot control whether
    the starting string will be in upper & lower case or a combination of
    the two. How can I add code that will recognize the string regardless
    of the case?

    Any help you can give would be great (I'm relatively new to VBA).
    Thanks!
    Robin


    Here's the beginning portion of my code. It's the strStart that is
    causing the problem.

    wbCRD.Worksheets("Pts, Driver Class, Age by Pts").Activate
    Range("B1").Activate

    If strChannel = "Agency" Then
    strStart = "Driver Class Factors"
    intStartRowOffset = 1
    strEnd = "END SECTION"
    intEndRowOffset = -2
    strColumn = "P"
    Else
    strStart = "Driver Class Factors"
    intStartRowOffset = 0
    strEnd = ""
    intEndRowOffset = -1
    strColumn = "P"
    End If

    strStartingCell = FindAddress(strStart, intStartRowOffset)


  2. #2
    Jim Rech
    Guest

    Re: VBA and Case Insensitive

    Put "Option Compare Text" at the top of this module. After that all string
    comparisons in that module will be case insensitive.

    --
    Jim
    <[email protected]> wrote in message
    news:[email protected]...
    |I have a piece of code that searches to find a string which triggers
    | the start of an event (copy/paste). However, I cannot control whether
    | the starting string will be in upper & lower case or a combination of
    | the two. How can I add code that will recognize the string regardless
    | of the case?
    |
    | Any help you can give would be great (I'm relatively new to VBA).
    | Thanks!
    | Robin
    |
    |
    | Here's the beginning portion of my code. It's the strStart that is
    | causing the problem.
    |
    | wbCRD.Worksheets("Pts, Driver Class, Age by Pts").Activate
    | Range("B1").Activate
    |
    | If strChannel = "Agency" Then
    | strStart = "Driver Class Factors"
    | intStartRowOffset = 1
    | strEnd = "END SECTION"
    | intEndRowOffset = -2
    | strColumn = "P"
    | Else
    | strStart = "Driver Class Factors"
    | intStartRowOffset = 0
    | strEnd = ""
    | intEndRowOffset = -1
    | strColumn = "P"
    | End If
    |
    | strStartingCell = FindAddress(strStart, intStartRowOffset)
    |



  3. #3

    Re: VBA and Case Insensitive

    Jim -

    This works great (I feel stupid, it's so simple).

    Thanks!
    Robin


+ 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