Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
don don is offline
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing upper case characters to upper/lower Richard Zignego Excel Discussion (Misc queries) 1 December 17th 07 10:09 PM
Changing file in all upper case to upper and lower case Sagit Excel Discussion (Misc queries) 15 May 30th 07 06:08 AM
Change from mixed caps and upper lower to all upper lower case Fish''s Mermaid Excel Worksheet Functions 3 October 13th 06 02:15 PM
How do I convert all upper case excel sheet into upper and lower . DebDay Excel Discussion (Misc queries) 1 March 9th 05 08:31 PM
How do I change Letter case (lower to Upper) in a spreadsheet??? mineisjosh Excel Discussion (Misc queries) 4 February 20th 05 01:49 AM


All times are GMT +1. The time now is 09:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"