+ Reply to Thread
Results 1 to 3 of 3

lower and upper case equal on spreadsheet but not equal in VB

  1. #1
    don
    Guest

    lower and upper case equal on spreadsheet but not equal in VB

    I am trying to get these product identifiers and others similiar to it
    to show as being equal. Code in the spreadsheet itself shows them
    equal. Code in VBA shows them as being not equal.

    RM92295A
    rm92295a
    RM92298A

    If I write A1= A2 in the spreadsheet they show as TRUE , ie, equal.

    However if I use this program in VBA they show as NOT EQUAL:
    Set Item = cells(1,1)
    Do Until Item.Offset(1, 0) <> Item
    Set Item = Item.Offset(1, 0)
    'MsgBox Item.Row
    Loop


    This data is being copied from a Lotus Approach database if that is
    relevant.

    Thanks for anyone's help to solve this.

    Don



  2. #2
    Jim Cone
    Guest

    Re: lower and upper case equal on spreadsheet but not equal in VB

    Don,

    Add... "Option Compare Text" as the first line in your module.
    For details look up "Option Compare" in vba help.

    Jim Cone
    San Francisco, USA



    "don" <[email protected]> wrote in message
    news:[email protected]...
    > I am trying to get these product identifiers and others similiar to it
    > to show as being equal. Code in the spreadsheet itself shows them
    > equal. Code in VBA shows them as being not equal.
    >
    > RM92295A
    > rm92295a
    > RM92298A
    >
    > If I write A1= A2 in the spreadsheet they show as TRUE , ie, equal.
    >
    > However if I use this program in VBA they show as NOT EQUAL:
    > Set Item = cells(1,1)
    > Do Until Item.Offset(1, 0) <> Item
    > Set Item = Item.Offset(1, 0)
    > 'MsgBox Item.Row
    > Loop
    > This data is being copied from a Lotus Approach database if that is
    > relevant.
    > Thanks for anyone's help to solve this.
    > Don



  3. #3
    Dave Peterson
    Guest

    Re: lower and upper case equal on spreadsheet but not equal in VB

    You could add:

    Option compare Text

    to the top of your module. But then all comparisons will be case-insensitive.

    You could conver to upper or lower (both sides) and compare them:

    do until lcase(item.offset(1,0).value) <> lcase(item.value)
    '''

    You could use strcomp()

    Do Until StrComp(item.Value, item.Offset(0, 1).Value, vbTextCompare) <> 0

    don wrote:
    >
    > I am trying to get these product identifiers and others similiar to it
    > to show as being equal. Code in the spreadsheet itself shows them
    > equal. Code in VBA shows them as being not equal.
    >
    > RM92295A
    > rm92295a
    > RM92298A
    >
    > If I write A1= A2 in the spreadsheet they show as TRUE , ie, equal.
    >
    > However if I use this program in VBA they show as NOT EQUAL:
    > Set Item = cells(1,1)
    > Do Until Item.Offset(1, 0) <> Item
    > Set Item = Item.Offset(1, 0)
    > 'MsgBox Item.Row
    > Loop
    >
    > This data is being copied from a Lotus Approach database if that is
    > relevant.
    >
    > Thanks for anyone's help to solve this.
    >
    > Don


    --

    Dave Peterson

+ 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