close

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 amp; 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!
RobinHere's the beginning portion of my code. It's the strStart that is
causing the problem.

wbCRD.Worksheets(quot;Pts, Driver Class, Age by Ptsquot;).Activate
Range(quot;B1quot;).Activate

If strChannel = quot;Agencyquot; Then
strStart = quot;Driver Class Factorsquot;
intStartRowOffset = 1
strEnd = quot;END SECTIONquot;
intEndRowOffset = -2
strColumn = quot;Pquot;
Else
strStart = quot;Driver Class Factorsquot;
intStartRowOffset = 0
strEnd = quot;quot;
intEndRowOffset = -1
strColumn = quot;Pquot;
End If

strStartingCell = FindAddress(strStart, intStartRowOffset)Put quot;Option Compare Textquot; at the top of this module. After that all string
comparisons in that module will be case insensitive.

--
Jim
gt; wrote in message ups.com...
|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 amp; 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(quot;Pts, Driver Class, Age by Ptsquot;).Activate
| Range(quot;B1quot;).Activate
|
| If strChannel = quot;Agencyquot; Then
| strStart = quot;Driver Class Factorsquot;
| intStartRowOffset = 1
| strEnd = quot;END SECTIONquot;
| intEndRowOffset = -2
| strColumn = quot;Pquot;
| Else
| strStart = quot;Driver Class Factorsquot;
| intStartRowOffset = 0
| strEnd = quot;quot;
| intEndRowOffset = -1
| strColumn = quot;Pquot;
| End If
|
| strStartingCell = FindAddress(strStart, intStartRowOffset)
|
Jim -

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

Thanks!
Robin

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()